Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

checkbox on my form

Locked
johan
Posts: 399
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

checkbox on my form

Unread post by johan »

Hi,

I wan't to add some checkbox on my form. I've tried html

Code: Select all

 <input type="checkbox" name="box1" value="1" />
Now I see my checkbox but how can I write 1 to my database when checked and 0 when unchecked?

Johan
shane
Posts: 100
Joined: Mon Jun 15, 2009 10:04 am

Re: checkbox on my form

Unread post by shane »

to do this you will need to create another (hidden) field on the screen and using a bit of JavaScript update the hidden field with the result of the tick-box, this way the value will be set through to be saved.

You will also need to have some JavaScript to populate the tick-box when the screen loads.

Alternatively you could just simple use a yes/no drop down and then you wouldn't need all of the above.
johan
Posts: 399
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: checkbox on my form

Unread post by johan »

Shane,

Thanks for your reply.

Now I know what to do.

Johan
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: checkbox on my form

Unread post by admin »

.
Locked