QuickForms: error in client validation uploading a file

From: Date: Mon, 29 Nov 2004 17:32:08 +0000
Subject: QuickForms: error in client validation uploading a file
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15906@lists.php.net to get a copy of this message
Hi, I have a form with two rules like these: ------------------------------------------------------------------------ $this->file =& $this->addElement('file', 'userfile', 'Imagen:(max:1MB)', array('size'=>50, 'maxlength'=>100)); $this->file2 =& $this->addElement('file', 'userfile2', 'Documento:(max:2MB)', array('size'=>50, 'maxlength'=>100)); ------------------------------------------------------------------------ and two rules: ------------------------------------------------------------------------ $this->addRule('userfile', 'El fichero de imagen es demasiado grande.', 'maxfilesize', 1048576,'client'); $this->addRule('userfile2', 'El fichero es demasiado grande.', 'maxfilesize', 2097152,'client'); ------------------------------------------------------------------------ that generates this piece of javascript: ------------------------------------------------------------------------ 86 value = frm.elements['userfile'].value; 87 if (value != '' && !_ruleCheckMaxFileSize(value, '1048576') && !errFlag['userfile']) { 88 errFlag['userfile'] = true; 89 _qfMsg = _qfMsg + '\n - El fichero de imagen es demasiado grande.'; 90 } 91 92 value = frm.elements['userfile2'].value; 93 if (value != '' && !_ruleCheckMaxFileSize(value, '2097152') && !errFlag['userfile2']) { 94 errFlag['userfile2'] = true; 95 _qfMsg = _qfMsg + '\n - El fichero es demasiado grande.'; 96 } ------------------------------------------------------------------------ and at last the browser get me this error message: ------------------------------------------------------------------------ Error: _ruleCheckMaxFileSize is not defined Source File: ... Line: 93 ------------------------------------------------------------------------ (at the second call!!) and the client validation is not done at all. Anyone with any ideas? I didn't find anything out there. Thanks. Toni.

« previous php.pear.general (#15906) next »