You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by marwa hussein <ma...@gmail.com> on 2020/10/06 12:42:29 UTC

The checkbox is checked by default!!

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*
<im...@yahoo.com>

Re: The checkbox is checked by default!!

Posted by marwa hussein <ma...@gmail.com>.
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 <ce...@gmail.com>
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 <ma...@gmail.com>
> wrote:
>
> > On Tue, Oct 6, 2020 at 5:17 PM Nathan Quirynen <
> > nathan@pensionarchitects.be>
> > 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: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> > --
> >
> >
> >
> > *Marwa Hussein M. TA @ Information Systems Department Faculty of
> Computers
> > & Information Assuit University*
> > <im...@yahoo.com>
> >
>


-- 



*Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
& Information Assuit University*
<im...@yahoo.com>

Re: The checkbox is checked by default!!

Posted by Cezary Biernacki <ce...@gmail.com>.
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 <ma...@gmail.com>
wrote:

> On Tue, Oct 6, 2020 at 5:17 PM Nathan Quirynen <
> nathan@pensionarchitects.be>
> 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: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> --
>
>
>
> *Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
> & Information Assuit University*
> <im...@yahoo.com>
>

Re: The checkbox is checked by default!!

Posted by marwa hussein <ma...@gmail.com>.
On Tue, Oct 6, 2020 at 5:17 PM Nathan Quirynen <na...@pensionarchitects.be>
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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

-- 



*Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
& Information Assuit University*
<im...@yahoo.com>

Re: The checkbox is checked by default!!

Posted by Nathan Quirynen <na...@pensionarchitects.be>.
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org