Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

checkbox on my form

Locked
johan
Posts: 392
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium

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: 392
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium

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: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: checkbox on my form

Unread post by admin »

.
Locked