|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
multiselect detect
hi all. i want to ask how can i detect if multipleselect is selected or it is empty upon the form is submitted? thank you.
if value is empty generate the below messgae: alert message("you must select at least one category"); |
|
#2
|
|||
|
|||
|
RE: multiselect detect
Code:
if (form.name.length <= 0) {
alert ("you must select at least one category");
}
|
|
#3
|
|||
|
|||
|
RE: multiselect detect
i have tried everything i know but still i can't get the javascript to work. thank you for any idea or solution you can give me.
on my form the code looks like this-->> <select multiple size="10" name='jobcategory[]'> <?php $job_list=array(' Actuarial Science / Statistics',' Advertising Client Servicing / Media Planning',' Agriculture / Forestry / Fisheries',' Architecture / Interior Design',' Arts / Creative / Graphics Design',' Aviation'); $vcnt=1; foreach ($job_list as $job_name){ echo "<option value='$vcnt'>$job_name</option>n"; $vcnt++; } ?> </select> and on the function formPreCheck(formobj){.......... }else if (document.appform.jobcategory.length <= 0){ alert("Please select at least one job category!"); //document.appform.language.focus(); return false; } please help. |
|
#4
|
|||
|
|||
|
RE: multiselect detect
Try using the selectedIndex property.
Change: }else if (document.appform.jobcategory.length <= 0){ to: }else if (document.appform.jobcategory.selectedIndex >= 0){ .length only returns the number of options in the select, not how many are selected |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > multiselect detect |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|