Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Javascript verification of multiple select fields KO

phpMyEdit General     Javascript verification of multiple select fields KO
Post new topic   Reply to topic    
 
hsicard     Joined: 22 Oct 2003   Posts: 17  
Post Posted: 2008-09-12 11:18
Back to top  Reply with quote     

When "required" is set to "true" on a multiple select field, the javascript does detect it hasn't been filled in, but it still submits the form.

As noted in the code:
/* Multiple selects have their name like ''name[]''. It is not possible to work with them directly, because theForm.name[].something will result into JavaScript syntax error. Following search algorithm is provided as a workaround for this.*/
The search algorithm mentionned above works fine to get the alert box opened, but same logic is not applied for the focus function, and following theForm.name[].focus() results in an error, and does not prevent the form to be submitted.
I hacked it as below. Great if it could be corrected in next CVS version!

if ($multiple) { //Hack HSI - quick and dirty: does not work if several multiple fields are required
echo '
multiple_select.focus();';
}else{
echo '
theForm.',$this->cgi['prefix']['data'].$this->fds[$k],'.focus();';
}

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy