Hi all,
I'm having some difficulties getting my form validation script to work properly. What I have right now is a drop-down menu that is empty by default. When the users complete the form and try to submit it without changing that drop-down menu, I want the form to catch it before its submitted and tell the user to enter a value.
I have a basic "if-then" statement to check if the drop-down menu value is empty, but no value seems to be passed through it, even if something is present. Here's the code for it:
<script language="VBScript">
Dim validation
Function CreateWR_onSubmit
validation = True
if Document.CreateWR.FloorSelect.Value = "" then
Msgbox "Invalid data"
validation = False
else
Msgbox "Your entry has been updated."
end if
if validation = True then
CreateWR_onSubmit = True
else
CreateWR_onSubmit = False
end if
end Function
</script>
The name of the form is CreateWR and the drop down menu is FloorSelect. I just want to make sure that when the form is filled out, that a Floor is picked.
However, if I picked for example "Ground Floor", it says there's invalid data. I made a msgbox to check if "Document.CreateWR.FloorSelect.Value" was working correctly, but it doesn't seem to be passing the values properly.
Any suggestions on what I need to do ? Any help is much appreciated.
Kevin
I'm having some difficulties getting my form validation script to work properly. What I have right now is a drop-down menu that is empty by default. When the users complete the form and try to submit it without changing that drop-down menu, I want the form to catch it before its submitted and tell the user to enter a value.
I have a basic "if-then" statement to check if the drop-down menu value is empty, but no value seems to be passed through it, even if something is present. Here's the code for it:
<script language="VBScript">
Dim validation
Function CreateWR_onSubmit
validation = True
if Document.CreateWR.FloorSelect.Value = "" then
Msgbox "Invalid data"
validation = False
else
Msgbox "Your entry has been updated."
end if
if validation = True then
CreateWR_onSubmit = True
else
CreateWR_onSubmit = False
end if
end Function
</script>
The name of the form is CreateWR and the drop down menu is FloorSelect. I just want to make sure that when the form is filled out, that a Floor is picked.
However, if I picked for example "Ground Floor", it says there's invalid data. I made a msgbox to check if "Document.CreateWR.FloorSelect.Value" was working correctly, but it doesn't seem to be passing the values properly.
Any suggestions on what I need to do ? Any help is much appreciated.
Kevin