Form validation

S

SS

I want to be able to validate two drop down boxes so at least one must have
been selected.

Is there a way to do this?

Cheers Shona
 
S

Stefan B Rusynko

Yes
but only w/ a custom JavaScript - not FP validation




| I want to be able to validate two drop down boxes so at least one must have
| been selected.
|
| Is there a way to do this?
|
| Cheers Shona
|
|
 
S

SS

Yes that is what I thought but was rather hoping someone would post how to
do it

Cheers Shona
 
J

Jon Spivey

Hi Shona,

Something along these lines.
<script type="text/javascript">
function checkBoxes(f){
if(f.drop1.selectedIndex ==0 && f.drop2.selectedindex==0){
alert("Your Error Message");
return false;}
return true;
}
</script>
<form onsubmit="return checkBoxes(this)">
<select name="drop1">
<option value="">Choose Something</option>
<option value="option1">Option 1</option>
etc
</select>
<select name="drop2">
<option value="">Choose Something</option>
<option value="option1">Option 1</option>
etc
</select>
 
J

Jon Spivey

Typo -
this
if(f.drop1.selectedIndex ==0 && f.drop2.selectedindex==0){
should be
if(f.drop1.selectedIndex ==0 && f.drop2.selectedIndex==0){

Capital I

Jon
 
Top