Javascript bug in quickform validation code
| From: | Mike Carter | Date: | Mon, 17 Nov 2003 11:28:18 +0000 |
| Subject: | Javascript bug in quickform validation code | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8987@lists.php.net to get a copy of this message | ||
Hello,
I have a quickform select list element defined along with a rule:
$this->addElement(
'select', 'matchList', '',
$matchingTerms,
array(
'size' => 15,
'cols' => 35,
'onchange' => "elements['matchTitle'].value =
elements['matchList'].options[this.selectedIndex].text",
));
$this->addRule('matchList', $this->language['L_RequireMatch'],
'required',
null, 'client');
The quickform (above) is a page within the controller. If I click
'previous' without first selecting anything in the list I should see the
validation error message. Instead (under IE6) I get a Javascript error
"Object doesn't support this property or method" on the 6th line of the
scirpt code below:
function validate_conditions() {
var value = '';
var errFlag = new Array();
_qfMsg = '';
var frm = document.forms['conditions'];
value = new Array(); //error on this line?
...
As I'm not very hot on javascript I was wondering if this is an error in
Quickform, or in the way I have declared my select element in some way?
Any ideas?
--
Mike Carter
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________