Welcome Guest, Not a member yet? Register   Sign In
Checkbox Help needed
#1

[eluser]K-Fella[/eluser]
Hi folks,

I need your help figuring this one out :ohh:

What I'm trying to do is have a checkbox ticked upon page load (before the form is submitted), but if the checkbox is unticked by the user and then the form is submitted, to show an unticked checkbox on the resulting page load.

My problem is, in order to tick the checkbox on the first page load I need to make sure no post data for that checkbox exists. If it doesn't I tell the form_checkbox() function to tick the box.
Code:
if (!isset($this->post->input['allow_email']))
{
echo form_checkbox('allow_email', 'on', TRUE);
}
But, if the box is unticked by the user and then they submit the form, no post data for the box exists on the resulting page load, so my if statement above kicks in and the checkbox is ticked again Undecided

What can I do?

The use of the set_checkbox() function won't help in this case. The only solution I can see working is to use javascript to set a hidden field containing a value of 'off' or 0 if the box is unticked, but if javascript is off in the browser I'm screwed!


Messages In This Thread
Checkbox Help needed - by El Forum - 08-27-2007, 10:26 AM
Checkbox Help needed - by El Forum - 08-27-2007, 11:14 AM
Checkbox Help needed - by El Forum - 08-27-2007, 01:24 PM
Checkbox Help needed - by El Forum - 08-28-2007, 05:06 AM
Checkbox Help needed - by El Forum - 08-28-2007, 06:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB