PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #134

Problem with 'file' element, 'maxfilesize' rule and client side validation

Details

Submitted2003-10-21 19:36 UTC
Fromsokol_d at go2 dot pl
StatusBogus
PackageHTML_QuickForm
PHP VersionIrrelevant
OSRH 9.0
Roadmaps(Not assigned)

Comments

[2003-10-21 19:36 UTC] sokol_d at go2 dot pl

Description:
------------
I found a problem connected with 'maxfilesize' rule (probably other 'file' rules too) and client side form validation. The QuickForm class generates javascript version of this rule, which is broken (contains the reference to php function!! (!_ruleCheckMaxFileSize() ) and it breakes the whole js function validate_{form name}. For this and other file rules probably there should be no js validation at all.

Reproduce code:
---------------
This broken javascript contains:

var value = frm.elements['photo'].value;
var field = frm.elements['photo'];
if (!_ruleCheckMaxFileSize('photo', value) && !errFlag['photo']) {
errFlag['photo'] = true;
_qfMsg = _qfMsg + '\n - Photo: File size must not exceed 50kb';
}

[2003-10-21 20:42 UTC] mansion at php dot net

Don't use javascript for file validation.