Form validation

  • Thread starter Thread starter SS
  • Start date Start date
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
 
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
|
|
 
Yes that is what I thought but was rather hoping someone would post how to
do it

Cheers Shona
 
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>
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Form Results from Excel spreadsheet 3
Scrolling Image 2
Check Box 4
Validate a field 3
Format date 3
Form 1
Form results contains or begins with 3
Form 6

Back
Top