HighDots Forums  

JavaScript

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss JavaScript in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
webuers
 
Posts: n/a

Default JavaScript - 11-25-2004 , 02:59 PM






I need a hint on this validation. If a user clicks the checkbox 1 the form
FirstName and LastName should not be required.

If he clicks form 2 they should become required


<INPUT name="UserIs" type="radio" value="Old">
<INPUT name="UserIs" type="radio" value="New" checked>

<INPUT name="FirstName" type="text" value="1">
<INPUT name="LastName" type="text" value="1">


Thanks!



Reply With Quote
  #2  
Old   
Mick White
 
Posts: n/a

Default Re: JavaScript - 11-25-2004 , 06:35 PM






webuers wrote:

Quote:
I need a hint on this validation. If a user clicks the checkbox 1 the form
FirstName and LastName should not be required.

If he clicks form 2 they should become required


INPUT name="UserIs" type="radio" value="Old"
INPUT name="UserIs" type="radio" value="New" checked

INPUT name="FirstName" type="text" value="1"
INPUT name="LastName" type="text" value="1"

<script type="text/javascript">
function validate(form){
if(form.UserIs[1].checked){
return form.LastName.value!="" && form.FirstName.value!=""
}
return true;
}
</script>
<form action="javascript:alert('submitted')"
onsubmit="return validate(this)">
<INPUT name="UserIs" type="radio" value="Old">Old
<INPUT name="UserIs" type="radio" value="New" checked>New
<INPUT name="FirstName" type="text">First Name
<INPUT name="LastName" type="text">Last Name
<input type="submit" value="submit">
Mick


Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.