hsicard
Joined: 22 Oct 2003
Posts: 17
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
|
|
|