You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/01/28 07:29:15 UTC
DO NOT REPLY [Bug 26485] New: -
automate maxlength validations
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26485>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26485
automate maxlength validations
Summary: automate maxlength validations
Product: Struts
Version: 1.1 Final
Platform: Other
OS/Version: Other
Status: NEW
Severity: Enhancement
Priority: Other
Component: Validator Framework
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: hauser@acm.org
It appears to be good practice to execute a maxlength validation for all form
fields, especially the ones eventually ending up in a database.
To save the programmer all the configuration writing chores, I suggest to
automate this in the following way:
Assume there is a registration form with the field "private String loginName;" -
if there is also
a) int loginName_maxLength = 60; //adapt value to permitted field length in DB
b) the below global "automateMaxLength" is set to "true"
then
i) always execute the "maxlength" validation rule (no need to list that in
validation.xml)
ii) always amend the '<html:text property="loginName"' in jsps using the
registration form with 'maxlength="60"' as per
http://jakarta.apache.org/struts/userGuide/struts-html.html#text
and
iii) if the below "autoOnChangeJS" is "true", amend the same '<html:text
property="loginName"' with an
'onchange="MODAL_MAX_LENGHT_AUTOGENERATED_JAVA_SCRIPT"' for those who expect
their visitors to have JavaScript enabled.
The configuration block in the struts-config.xml thus should be enhanced with
two properties:
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
...
<set-property property="automateMaxLength" value="true"/>
<set-property property="autoOnChangeJS" value="true"/>
...
</plug-in>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org