• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Dropdown Validation

Dropdown Validation 13 years 5 months ago #15518

  • kamcl
  • kamcl's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Can anyone explain how I can validate a dropdown box? Top option is "Choose One". I'd like to make sure an option is chosen. I do not know Javascript but I can cut and paste with the best of them.

Also, I'd like a pony.

Thanks!
The administrator has disabled public write access.

Re: Dropdown Validation 13 years 1 month ago #16724

kamcl..did you happen to get this figured out? I'd like to know the same thing..

Thanks,
Bob
The administrator has disabled public write access.

Re: Dropdown Validation 13 years 1 month ago #16736

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
Have you tried the 'required' attribute on the field?

Also, there are lots of articles that describe how to do this in Javascript, here is one:

lab.artlung.com/validate-checkbox/
The administrator has disabled public write access.

Re: Dropdown Validation 12 years 7 months ago #19048

  • frankygr
  • frankygr's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Here is the solution :

1/- First go to the properties tab of your form, and under "layout" ---> "css and javascript" put the following code:

</code>
<script type="text/javascript">
function checkTheBox(TheNameOfYourForm) {
if (document.getElementById('TheNameofYourDropDownBox').options[0] .selected)
{
alert('Please make a choice !');
return false;
}
else {
return true;
}
}
</script>
</code>

explanations for this script:
replace "TheNameOfYourForm" by the Name of your form
replace "TheNameofYourDropDownBox" by the Name of your dropdown box
.options[0] .selected means that your option "Choose One" is the only one selected for the moment

2/- Finally click on fields tab and edit your submit button and put the following code under the additional attributs :

<code>
onclick="return checkTheBox('TheNameofYourDropDownBox');"
</code>

That's all folks !
The administrator has disabled public write access.

Dropdown Validation 12 years 1 month ago #22312

The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!