Code Comments
Programming Forum and web based access to our favorite programming groups.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 java script:
------------------------------------------------------------------------
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.
Post Follow-up to this messagequote:This is simply a bug with the client-side validation of file elements in HTML_Quickform . The bug was reported here: http://pear.php.net/bugs/bug.php?id=134 The problem is that _ruleCheckMaxFileSize is a PHP function (not a javascrip t function). However, the recommendation from the PEAR site is to simply no t use client-side validation for file elements. Hope that helps.
Originally posted by Toni 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 java script: ------------------------------------------------------------------------ 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.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.