Hi Kip,

KL> When I do a form submit cgi.params.exists('carton') should be true but
KL> it should have no value if the checkbox is unselected. If I just point
KL> I hope I'm making sense.
KL> Can anybody help me?

You are making a wrong assumption about the unchecked form variable.
If a form checkbox is unchecked, it's name and value are NOT passed.


Friday, November 21, 2003, 10:31:25 AM, you wrote:

KL> Could someone please help me with this?

KL> I've got a form with a checkbox input type on it called carton.

KL> In tt2 when I check to see if the checkbox is checked I do:

KL> [%
KL>   USE cgi=CGI;

KL>   IF cgi.params.carton == 'on';
KL>     %]Cart is on![%
KL>   END;
KL> %]

KL> This works great!

KL> My problem is that I need to also detect if the carton checkbox has been
KL> deselected. I've tried:

KL> [%
KL>   USE cgi=CGI;

KL>   IF cgi.params.exists('carton') && cgi.params.carton == '';
KL>     ## I've also tried defined above
KL>     %]Cart is off![%
KL>   END;
KL> %]

KL> I see no way to tell if the checkbox was unselected.

KL> If I point my browser to the url instead of clicking on a submit button
KL> that goes to the page I would like to see a difference.

KL> When I do a form submit cgi.params.exists('carton') should be true but
KL> it should have no value if the checkbox is unselected. If I just point
KL> my browser to the page no form variables should exist so
KL> cgi.params.exists('carton') should be false.

KL> I hope I'm making sense.
KL> Can anybody help me?




-- 
Best regards,
 christopher                            mailto:[EMAIL PROTECTED]


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to