Link to home
Create AccountLog in
Avatar of gfranco
gfrancoFlag for United States of America

asked on

Drop Down list validation using Java Script in ASP.NET VB.NET

Hi,
I need to have a validate function that allow me to identify elements (different drown list) when they were not selected.After being called by validate function Thanks for your help


<script>
function validateDDList(ctlname,ddlctl)
     {
         
         if (ddlctl.value.index == 0) {
             alert(ctlname + ' Select at least one option from the list');
             ddlctl.focus();
             return false;
         }
         return true;
         

     }

</script>


         
function validate() {

if(!validateDDListt('Select at least one list from y ',<%= ddEntityCountry.ClientID %>))
     return false;

Open in new window

Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Could you plz explain the que a bit more
Avatar of gfranco

ASKER

Sure, I have 3 drop down list country state and city, I want to use a function that assure user to pick a record for each drop down. This function I am planning to use on master page since I have other pages to validate. So the function enforce the selection and avoid no values on submission. The message will be generic upon depend on combo selection
The form is being called at the end of wizard template finish button. Hope this helps
I hope this clarify
Avatar of gfranco

ASKER

Thanks field validate is not an option I am trying to use the same function for all of them thanks
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer