Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Ignore my previous message


Message #1 by "Robert Nyman" <robert.nyman@c...> on Mon, 23 Sep 2002 17:41:51 +0200
Ignore my previous message below...




-----Ursprungligt meddelande-----
Fr=E5n: Robert Nyman [mailto:robert.nyman@c...]
Skickat: den 23 september 2002 17:39
Till: javascript
=C4mne: [javascript] SV: checkbox control and request.form problem


Did you see my reply, with code that solves your problem?

If not, here it is again:


function checkForm(){
	if(!document.myForm.elements["myCheckBox"].checked){
		alert("You have to check the checkbox");
		return false;
	}
	else {
		return true;=09
	}
}


<form name=3D"myForm" onSubmit=3D"return checkForm()">
	<input type=3D"checkbox" name=3D"myCheckBox">
	<input type=3D"submit" value=3D"Send">
</form>


/Robert



-----Ursprungligt meddelande-----
Fr=E5n: mike [mailto:mihalist80@h...]
Skickat: den 23 september 2002 16:40
Till: javascript
=C4mne: [javascript] checkbox control and request.form problem


you didnt understand me.i submit this page with the form with the
checkboxes.the user is allowed to leave a blan checkbox.what i have to
do
in this case?

this is page1.asp :

<html><body>

<% myvar =3D request.form("myckbox")

response.write "the value of check box is " & myvar

 %>

<form name=3D"myform" action=3D" page1.asp" method=3D"post">

<input type=3D"checkbox" name =3D "myckbox" value=3D"ok">

<input type=3D"submit" name=3D"submit" value=3D"ok">

</form></body></html>





if i leave unchecked myckbox , it does not return any value at all


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20


  Return to Index