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=22462>. 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=22462 JavaScript generation with page Summary: JavaScript generation with page Product: Struts Version: 1.1 Final Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Validator Framework AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] There is a problem with the dynamic JavaScript generation. If you have two form validations on the same page, there is a conflict with the methods that are created. Here is the JavaScript for both forms: (I compressed all the code so that it is easier to read.) TOP FORM: <script type="text/javascript" language="Javascript1.1"> <!-- Begin var bCancel = false; function validateVoiceSegmentSearchForm(form) { if (bCancel) return true; else return validateInteger(form) && validateRequired(form) && validateMaxLength(form); } function IntegerValidations () { this.aa = new Array("searchId", "Segment ID must be an integer.", new Function ("varName", " return this[varName];")); } function required () { this.aa = new Array("searchId", "Segment ID is required.", new Function ("varName", " return this[varName];")); } function maxlength () { } //End --> </script> BOTTOM FORM: <script type="text/javascript" language="Javascript1.1"> <!-- Begin var bCancel = false; function validateVoiceSegmentForm(form) { if (bCancel) return true; else return validateInteger(form) && validateRequired(form) && validateMaxLength(form); } function IntegerValidations () { } function required () { this.aa = new Array("languageID", "Language is required.", new Function ("varName", " return this[varName];")); this.ab = new Array("voiceTalentID", "Talent is required.", new Function ("varName", " return this[varName];")); } function maxlength () { this.aa = new Array("description", "Description can not be greater than 255 characters.", new Function ("varName", "this.maxlength='255'; return this[varName];")); this.ab = new Array("voiceText", "Voice Text can not be greater than 6000 characters.", new Function ("varName", "this.maxlength='6000'; return this[varName];")); this.ac = new Array("webText", "Voice Text can not be greater than 6000 characters.", new Function ("varName", "this.maxlength='6000'; return this[varName];")); } //End --> </script> The first problem is that it creates functions and function calls that should not be there: The first one contains maxlength() and a call validateMaxLength(form). The second one contains IntegerValidations() and a call validateInteger(form). The problem is that the JavaScript tag is not checking the page variable when it is checking for the functions to add. It is only checking when it adds the body to the functions. The result is that when I am trying to do the first validation it uses the required() and empty IntegerValidations() that was created in the second script. The second validation works fine since its functions are defined last. The only way that I can get the first validation to work is to set dynamicJavascript='false' for the second validation. The funcions should also have a more specific name like: validateVoiceSegmentFormRequired() and validateVoiceSegmentSearchFormRequired() I now that the Validator JavaScripts are requiring a function like required() to be generated, so you might want to have the Validator JavaScript functions except parameters instead of calling the generated method. In summary, validation functions and function calls should ONLY be generated when the page matches; the generated functions should have dynamic names or the properties should be passed to the Validator JavaScript function. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]