The checkbox is checked by default!!

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The checkbox is checked by default!!

Marwa
Hi all,

I am trying to populate a grid with some values and add a column with a
checkbox to select a value..

<t:grid t:source="OntologyInfoList"  row="OntologyInfo" add="Select">

          <p:selectcell>
        <t:checkbox t:id="select" value="acronyms"/>

The problem when the grid is populated I found the Checkbox checked by
default, although I didn't use the "check" attribute (which suppose to be
"false" by default)!!
how can I make solve this and make it unchecked in the begining??

Regards,
Marwa

--



*Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
& Information Assuit University*
<[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: The checkbox is checked by default!!

nquirynen
Is it possible that your "acronyms" property has a value of true when
rendering ?

Op 6/10/2020 om 14:42 schreef marwa hussein:

> Hi all,
>
> I am trying to populate a grid with some values and add a column with a
> checkbox to select a value..
>
> <t:grid t:source="OntologyInfoList"  row="OntologyInfo" add="Select">
>
>            <p:selectcell>
>          <t:checkbox t:id="select" value="acronyms"/>
>
> The problem when the grid is populated I found the Checkbox checked by
> default, although I didn't use the "check" attribute (which suppose to be
> "false" by default)!!
> how can I make solve this and make it unchecked in the begining??
>
> Regards,
> Marwa
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: The checkbox is checked by default!!

Marwa
On Tue, Oct 6, 2020 at 5:17 PM Nathan Quirynen <[hidden email]>
wrote:

> Is it possible that your "acronyms" property has a value of true when
> rendering ?
>
> No it is not. Also I am wondering what could make the "checked" attribute
default to be true!!
Also I cant find in tapestry API how to change the attribute checked value
to false!!


>
> Op 6/10/2020 om 14:42 schreef marwa hussein:
> > Hi all,
> >
> > I am trying to populate a grid with some values and add a column with a
> > checkbox to select a value..
> >
> > <t:grid t:source="OntologyInfoList"  row="OntologyInfo" add="Select">
> >
> >            <p:selectcell>
> >          <t:checkbox t:id="select" value="acronyms"/>
> >
> > The problem when the grid is populated I found the Checkbox checked by
> > default, although I didn't use the "check" attribute (which suppose to be
> > "false" by default)!!
> > how can I make solve this and make it unchecked in the begining??
> >
> > Regards,
> > Marwa
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--



*Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
& Information Assuit University*
<[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: The checkbox is checked by default!!

Cezary Biernacki
Hi,

Tapestry's t:checkbox parameter uses the "value" parameter to determine if
the checkbox should be rendered as checked or not. the "value" parameter
supposed to be a boolean, but if you provide anything else, Tapestry will
attempt to coerce the provided argument to boolean.  There are multiple
built-in Tapestry coercions from various Java types to boolean, some
examples:

   - String - if it is empty or null or equal to "false" (case insensitive)
   is coerced false, otherwise true.
   - Numbers (int, long, etc.) - non-zero values are true;
   - Collections (lists, maps) - non-empty are true;
   - Any other generic object, not coerced otherwise - non-null values are
   true;

So, in your case, "acronyms" is something that Tapestry coerces to Boolean
as the "true" value. If you need to make the checkbox unchecked, provide
the "value" parameter that evaluates as "false".

About coercions you can read here:
https://tapestry.apache.org/parameter-type-coercion.html
https://tapestry.apache.org/type-coercion.html

Details about default type coercions can be found here:
https://github.com/apache/tapestry-5/blob/master/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java

Cezary


On Tue, Oct 6, 2020 at 9:33 PM marwa hussein <[hidden email]>
wrote:

> On Tue, Oct 6, 2020 at 5:17 PM Nathan Quirynen <
> [hidden email]>
> wrote:
>
> > Is it possible that your "acronyms" property has a value of true when
> > rendering ?
> >
> > No it is not. Also I am wondering what could make the "checked" attribute
> default to be true!!
> Also I cant find in tapestry API how to change the attribute checked value
> to false!!
>
>
> >
> > Op 6/10/2020 om 14:42 schreef marwa hussein:
> > > Hi all,
> > >
> > > I am trying to populate a grid with some values and add a column with a
> > > checkbox to select a value..
> > >
> > > <t:grid t:source="OntologyInfoList"  row="OntologyInfo" add="Select">
> > >
> > >            <p:selectcell>
> > >          <t:checkbox t:id="select" value="acronyms"/>
> > >
> > > The problem when the grid is populated I found the Checkbox checked by
> > > default, although I didn't use the "check" attribute (which suppose to
> be
> > > "false" by default)!!
> > > how can I make solve this and make it unchecked in the begining??
> > >
> > > Regards,
> > > Marwa
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> --
>
>
>
> *Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
> & Information Assuit University*
> <[hidden email]>
>
Reply | Threaded
Open this post in threaded view
|

Re: The checkbox is checked by default!!

Marwa
thanks, Cezary
It works now. My mistake is that "acronyms" property was a String and that
why it has the value true and the checkbox was checked.
I change it to boolean and it works :).

Regards
Marwa


On Tue, Oct 6, 2020 at 10:05 PM Cezary Biernacki <[hidden email]>
wrote:

> Hi,
>
> Tapestry's t:checkbox parameter uses the "value" parameter to determine if
> the checkbox should be rendered as checked or not. the "value" parameter
> supposed to be a boolean, but if you provide anything else, Tapestry will
> attempt to coerce the provided argument to boolean.  There are multiple
> built-in Tapestry coercions from various Java types to boolean, some
> examples:
>
>    - String - if it is empty or null or equal to "false" (case insensitive)
>    is coerced false, otherwise true.
>    - Numbers (int, long, etc.) - non-zero values are true;
>    - Collections (lists, maps) - non-empty are true;
>    - Any other generic object, not coerced otherwise - non-null values are
>    true;
>
> So, in your case, "acronyms" is something that Tapestry coerces to Boolean
> as the "true" value. If you need to make the checkbox unchecked, provide
> the "value" parameter that evaluates as "false".
>
> About coercions you can read here:
> https://tapestry.apache.org/parameter-type-coercion.html
> https://tapestry.apache.org/type-coercion.html
>
> Details about default type coercions can be found here:
>
> https://github.com/apache/tapestry-5/blob/master/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java
>
> Cezary
>
>
> On Tue, Oct 6, 2020 at 9:33 PM marwa hussein <[hidden email]>
> wrote:
>
> > On Tue, Oct 6, 2020 at 5:17 PM Nathan Quirynen <
> > [hidden email]>
> > wrote:
> >
> > > Is it possible that your "acronyms" property has a value of true when
> > > rendering ?
> > >
> > > No it is not. Also I am wondering what could make the "checked"
> attribute
> > default to be true!!
> > Also I cant find in tapestry API how to change the attribute checked
> value
> > to false!!
> >
> >
> > >
> > > Op 6/10/2020 om 14:42 schreef marwa hussein:
> > > > Hi all,
> > > >
> > > > I am trying to populate a grid with some values and add a column
> with a
> > > > checkbox to select a value..
> > > >
> > > > <t:grid t:source="OntologyInfoList"  row="OntologyInfo" add="Select">
> > > >
> > > >            <p:selectcell>
> > > >          <t:checkbox t:id="select" value="acronyms"/>
> > > >
> > > > The problem when the grid is populated I found the Checkbox checked
> by
> > > > default, although I didn't use the "check" attribute (which suppose
> to
> > be
> > > > "false" by default)!!
> > > > how can I make solve this and make it unchecked in the begining??
> > > >
> > > > Regards,
> > > > Marwa
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> > --
> >
> >
> >
> > *Marwa Hussein M. TA @ Information Systems Department Faculty of
> Computers
> > & Information Assuit University*
> > <[hidden email]>
> >
>


--



*Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
& Information Assuit University*
<[hidden email]>