Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-31-2006, 09:58 AM   PM User | #1
ooiyh
New Coder

 
Join Date: Apr 2005
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
ooiyh is an unknown quantity at this point
Change checkbox value

Is this how you change checkbox value?
If so, it seems that I cant pass my value for SQL processing once I unchecked the checked box.

Javascipt:
Code:
function changevalue()
{
	box = eval("document.form1.gopublic");
	if (box.checked == false) 
	{
		alert("disallow");
		document.form1.gopublic[0].value = "disallow";
	}
	else
	{
		alert("allow");
		document.form1.gopublic[0].value = "allow";
	}
}
HTML
Code:
<input name="gopublic" type="checkbox" id="gopublic" value="allow" checked="checked"  onclick="changevalue()"/>
ooiyh is offline   Reply With Quote
Old 08-31-2006, 11:02 AM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
un unchecked checkbox is not an active element, thus it's value will not be submit. Use rather a pair of radio buttons, one of them checeked by default.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 PM.


Advertisement
Log in to turn off these ads.