You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Viggio, Alex" <Al...@globalcrossing.com> on 2003/06/13 22:16:33 UTC

[OT] FRIDAY: HTML Checkboxes SUCK!!!

Is it just me?!? ;)

In our last release, I replaced all of the checkboxes with YES/NO dropdowns
(<select> and <options> tags using a Collection for the
"YES"=true/"NO"=false mapping). 

The users seem to prefer this user interface (no one's complained at least)
and I can still tie these to a ActionForm boolean property thanks to
aforementioned Collection (via <define> tag)! We have a complex,
multi-part/layer wizard workflow using the nesting tablib extensively so the
code was begging for refactorings. This UI change allowed us to get rid of
all of the kludgy code to support these retarded HTML checkboxes (cya
ActionForm reset()). 

What were you thinking W3C spec gurus!

Apologies if you momma worked on the HTML checkbox spec, but it's Friday the
13th and I'm flying to a warm, tropical beach tomorrow!!!

- Alex

p.s. I'm sure that there is a more elegant solution -- feel free to share...

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Brian McSweeney <br...@aurium.net>.
thanks for all the help Tib,
I'll give it a try.
Brian


----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, June 16, 2003 12:03 PM
Subject: Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!


> Brian McSweeney írta:
>
> >So how would you do that for yes|no ?
> >Something like:
> >
> > <field property="myField"
> >       depends="mask">
> >       <arg0 key="myField"/>
> >       <var>
> >               <var-name>mask</var-name>
> >               <var-value>yes|no</var-value>
> >       </var>
> > </field>
> >
> >Forgive my woeful lack of regular expression knowledge :-)
> >
> It uses the javascript regexp  in conjuction with the jakarta-oro
> regexps. jakarta-oro
> is almost fully compatible w/ perl type regexps.
> I've learned all my regexp knowledge from the perlre manual pages.
> This might help you as well. Check this out:
> http://www.perldoc.com/perl5.6.1/pod/perlre.html
>
> Here is an example for this:
>                <var>
>                    <var-name>mask</var-name>
>                    <var-value>(yes|no)</var-value>
>                </var>
>
> I am thinking whether the required validator would be enough however a
> naughty
> power-user entering invalid request-parameters could make the app throw
> exception
> in this case.
>
> Tib
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Gemes Tibor <ti...@i-trade.hu>.
Brian McSweeney írta:

>So how would you do that for yes|no ?
>Something like:
>
> <field property="myField"
>       depends="mask">
>       <arg0 key="myField"/>
>       <var>
>               <var-name>mask</var-name>
>               <var-value>yes|no</var-value>
>       </var>
> </field>
>
>Forgive my woeful lack of regular expression knowledge :-)
>
It uses the javascript regexp  in conjuction with the jakarta-oro 
regexps. jakarta-oro
is almost fully compatible w/ perl type regexps.
I've learned all my regexp knowledge from the perlre manual pages.
This might help you as well. Check this out:
http://www.perldoc.com/perl5.6.1/pod/perlre.html

Here is an example for this:
               <var>
                   <var-name>mask</var-name>
                   <var-value>(yes|no)</var-value>
               </var>

I am thinking whether the required validator would be enough however a 
naughty
power-user entering invalid request-parameters could make the app throw 
exception
in this case.

Tib



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Brian McSweeney <br...@aurium.net>.
Hey Tib,

thanks for the tip.
I've never used the mask validator before.
If I'm right, it's used for custom regular expression
validation.

So how would you do that for yes|no ?
Something like:

 <field property="myField"
       depends="mask">
       <arg0 key="myField"/>
       <var>
               <var-name>mask</var-name>
               <var-value>yes|no</var-value>
       </var>
 </field>

Forgive my woeful lack of regular expression knowledge :-)

cheers,
Brian




----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, June 16, 2003 10:46 AM
Subject: Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!


> Andrew Hill írta:
>
> >That Im not sure, as Ive not played with the validator myself. It should
be
> >possible, but you may need to use a String property in your ActionForm as
> >you now have 3 possible values to populate with...
> >
> >
> What about "yes"/"no"/""  (empty)?
>
> In this case a (yes|no) mask validator is enough.
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Gemes Tibor <ti...@i-trade.hu>.
Andrew Hill írta:

>That Im not sure, as Ive not played with the validator myself. It should be
>possible, but you may need to use a String property in your ActionForm as
>you now have 3 possible values to populate with...
>  
>
What about "yes"/"no"/""  (empty)?

In this case a (yes|no) mask validator is enough.

Tib




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Brian McSweeney <br...@aurium.net>.
Ah,
thanks Andrew,
so perhaps if I set the field to required using the validator I can get the
same effect.
Thanks for your help,
Brian

----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts" <st...@jakarta.apache.org>
Sent: Monday, June 16, 2003 10:40 AM
Subject: RE: [OT] FRIDAY: HTML Checkboxes SUCK!!!


> That Im not sure, as Ive not played with the validator myself. It should
be
> possible, but you may need to use a String property in your ActionForm as
> you now have 3 possible values to populate with...
>
>
> I actually validate in my actions and use string values on my actionforms
> for everything including true/false values. In the case of a checkbox my
> reset sets to "false" so my validation code checks to see if the string is
> "true" or "false". If I change my ui to submit that field from a select
box
> and provide a blank option whose value is an empty string my validation
code
> will pick it up when the user selects it and add an ActionError to the
> effect that the field wasnt filled in...
>
> -----Original Message-----
> From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
> Sent: Monday, 16 June 2003 17:26
> To: Struts Users Mailing List; andrew.david.hill@gridnode.com
> Subject: Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!
>
>
> I was just thinking about doing the same because of the many messages
> discussing the evils of checkboxes. I would also like to use what you
> suggested Andrew --> an empty option that doesn't pass validation.
>
> However, I wonder is it possible to do this type of validation with the
> validator?
>
> thanks,
> Brian
>
>
> ----- Original Message -----
> From: "Andrew Hill" <an...@gridnode.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, June 16, 2003 4:23 AM
> Subject: RE: [OT] FRIDAY: HTML Checkboxes SUCK!!!
>
>
> > +1
> >
> > Im thinking of doing the same.
> > Checkboxes are evil.
> >
> > Another bonus to using dropdowns instead is that if you really need the
> user
> > to think about whether that field should be true or false then you can
add
> > an extra empty choice that doesnt pass validation. That way they will be
> > forced to set a value in that field whereas with a checkbox they can
> easily
> > forget to tick it and submit a false value by mistake...
> >
> > My theory on what the w3c specs guys were thinking tends to involve them
> > down the pub having a few too many beers and one of them saying "hey
guys!
> > Ive got an idea - wouldnt it be funny if we..."
> >
> > -----Original Message-----
> > From: Viggio, Alex [mailto:Alex.Viggio@globalcrossing.com]
> > Sent: Saturday, 14 June 2003 04:17
> > To: 'Struts Users Mailing List'
> > Subject: [OT] FRIDAY: HTML Checkboxes SUCK!!!
> >
> >
> > Is it just me?!? ;)
> >
> > In our last release, I replaced all of the checkboxes with YES/NO
> dropdowns
> > (<select> and <options> tags using a Collection for the
> > "YES"=true/"NO"=false mapping).
> >
> > The users seem to prefer this user interface (no one's complained at
> least)
> > and I can still tie these to a ActionForm boolean property thanks to
> > aforementioned Collection (via <define> tag)! We have a complex,
> > multi-part/layer wizard workflow using the nesting tablib extensively so
> the
> > code was begging for refactorings. This UI change allowed us to get rid
of
> > all of the kludgy code to support these retarded HTML checkboxes (cya
> > ActionForm reset()).
> >
> > What were you thinking W3C spec gurus!
> >
> > Apologies if you momma worked on the HTML checkbox spec, but it's Friday
> the
> > 13th and I'm flying to a warm, tropical beach tomorrow!!!
> >
> > - Alex
> >
> > p.s. I'm sure that there is a more elegant solution -- feel free to
> share...
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Andrew Hill <an...@gridnode.com>.
That Im not sure, as Ive not played with the validator myself. It should be
possible, but you may need to use a String property in your ActionForm as
you now have 3 possible values to populate with...


I actually validate in my actions and use string values on my actionforms
for everything including true/false values. In the case of a checkbox my
reset sets to "false" so my validation code checks to see if the string is
"true" or "false". If I change my ui to submit that field from a select box
and provide a blank option whose value is an empty string my validation code
will pick it up when the user selects it and add an ActionError to the
effect that the field wasnt filled in...

-----Original Message-----
From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
Sent: Monday, 16 June 2003 17:26
To: Struts Users Mailing List; andrew.david.hill@gridnode.com
Subject: Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!


I was just thinking about doing the same because of the many messages
discussing the evils of checkboxes. I would also like to use what you
suggested Andrew --> an empty option that doesn't pass validation.

However, I wonder is it possible to do this type of validation with the
validator?

thanks,
Brian


----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, June 16, 2003 4:23 AM
Subject: RE: [OT] FRIDAY: HTML Checkboxes SUCK!!!


> +1
>
> Im thinking of doing the same.
> Checkboxes are evil.
>
> Another bonus to using dropdowns instead is that if you really need the
user
> to think about whether that field should be true or false then you can add
> an extra empty choice that doesnt pass validation. That way they will be
> forced to set a value in that field whereas with a checkbox they can
easily
> forget to tick it and submit a false value by mistake...
>
> My theory on what the w3c specs guys were thinking tends to involve them
> down the pub having a few too many beers and one of them saying "hey guys!
> Ive got an idea - wouldnt it be funny if we..."
>
> -----Original Message-----
> From: Viggio, Alex [mailto:Alex.Viggio@globalcrossing.com]
> Sent: Saturday, 14 June 2003 04:17
> To: 'Struts Users Mailing List'
> Subject: [OT] FRIDAY: HTML Checkboxes SUCK!!!
>
>
> Is it just me?!? ;)
>
> In our last release, I replaced all of the checkboxes with YES/NO
dropdowns
> (<select> and <options> tags using a Collection for the
> "YES"=true/"NO"=false mapping).
>
> The users seem to prefer this user interface (no one's complained at
least)
> and I can still tie these to a ActionForm boolean property thanks to
> aforementioned Collection (via <define> tag)! We have a complex,
> multi-part/layer wizard workflow using the nesting tablib extensively so
the
> code was begging for refactorings. This UI change allowed us to get rid of
> all of the kludgy code to support these retarded HTML checkboxes (cya
> ActionForm reset()).
>
> What were you thinking W3C spec gurus!
>
> Apologies if you momma worked on the HTML checkbox spec, but it's Friday
the
> 13th and I'm flying to a warm, tropical beach tomorrow!!!
>
> - Alex
>
> p.s. I'm sure that there is a more elegant solution -- feel free to
share...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Brian McSweeney <br...@aurium.net>.
I was just thinking about doing the same because of the many messages
discussing the evils of checkboxes. I would also like to use what you
suggested Andrew --> an empty option that doesn't pass validation.

However, I wonder is it possible to do this type of validation with the
validator?

thanks,
Brian


----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, June 16, 2003 4:23 AM
Subject: RE: [OT] FRIDAY: HTML Checkboxes SUCK!!!


> +1
>
> Im thinking of doing the same.
> Checkboxes are evil.
>
> Another bonus to using dropdowns instead is that if you really need the
user
> to think about whether that field should be true or false then you can add
> an extra empty choice that doesnt pass validation. That way they will be
> forced to set a value in that field whereas with a checkbox they can
easily
> forget to tick it and submit a false value by mistake...
>
> My theory on what the w3c specs guys were thinking tends to involve them
> down the pub having a few too many beers and one of them saying "hey guys!
> Ive got an idea - wouldnt it be funny if we..."
>
> -----Original Message-----
> From: Viggio, Alex [mailto:Alex.Viggio@globalcrossing.com]
> Sent: Saturday, 14 June 2003 04:17
> To: 'Struts Users Mailing List'
> Subject: [OT] FRIDAY: HTML Checkboxes SUCK!!!
>
>
> Is it just me?!? ;)
>
> In our last release, I replaced all of the checkboxes with YES/NO
dropdowns
> (<select> and <options> tags using a Collection for the
> "YES"=true/"NO"=false mapping).
>
> The users seem to prefer this user interface (no one's complained at
least)
> and I can still tie these to a ActionForm boolean property thanks to
> aforementioned Collection (via <define> tag)! We have a complex,
> multi-part/layer wizard workflow using the nesting tablib extensively so
the
> code was begging for refactorings. This UI change allowed us to get rid of
> all of the kludgy code to support these retarded HTML checkboxes (cya
> ActionForm reset()).
>
> What were you thinking W3C spec gurus!
>
> Apologies if you momma worked on the HTML checkbox spec, but it's Friday
the
> 13th and I'm flying to a warm, tropical beach tomorrow!!!
>
> - Alex
>
> p.s. I'm sure that there is a more elegant solution -- feel free to
share...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [OT] FRIDAY: HTML Checkboxes SUCK!!!

Posted by Andrew Hill <an...@gridnode.com>.
+1

Im thinking of doing the same.
Checkboxes are evil.

Another bonus to using dropdowns instead is that if you really need the user
to think about whether that field should be true or false then you can add
an extra empty choice that doesnt pass validation. That way they will be
forced to set a value in that field whereas with a checkbox they can easily
forget to tick it and submit a false value by mistake...

My theory on what the w3c specs guys were thinking tends to involve them
down the pub having a few too many beers and one of them saying "hey guys!
Ive got an idea - wouldnt it be funny if we..."

-----Original Message-----
From: Viggio, Alex [mailto:Alex.Viggio@globalcrossing.com]
Sent: Saturday, 14 June 2003 04:17
To: 'Struts Users Mailing List'
Subject: [OT] FRIDAY: HTML Checkboxes SUCK!!!


Is it just me?!? ;)

In our last release, I replaced all of the checkboxes with YES/NO dropdowns
(<select> and <options> tags using a Collection for the
"YES"=true/"NO"=false mapping).

The users seem to prefer this user interface (no one's complained at least)
and I can still tie these to a ActionForm boolean property thanks to
aforementioned Collection (via <define> tag)! We have a complex,
multi-part/layer wizard workflow using the nesting tablib extensively so the
code was begging for refactorings. This UI change allowed us to get rid of
all of the kludgy code to support these retarded HTML checkboxes (cya
ActionForm reset()).

What were you thinking W3C spec gurus!

Apologies if you momma worked on the HTML checkbox spec, but it's Friday the
13th and I'm flying to a warm, tropical beach tomorrow!!!

- Alex

p.s. I'm sure that there is a more elegant solution -- feel free to share...

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org