Hi All,
   
  I'm new in struts , I have problems with struts validation, my application 
was using struts 1.1 and validator 1.0,,i'm trying to upgrade to struts 1.2.7 
and common validator 1.1.4 because i use non default resource bundle as arg key 
in validation. My problem is when struts generates the javascript function for 
validation , the name of the function always starts with i.e, 
formname_required(). That's problem to my application because sometimes i'm 
using one action form for more than one page, and the validation will be 
generated error. To make it clearer i'll give example 
   
  //the javascript validation created by struts
   var bCancel = false; 
      function validateServiceForm(form) {                                      
                             
        if (bCancel) 
      return true; 
        else 
 var formValidationResult;
       formValidationResult = validateDate(form); 
     return (formValidationResult == 1);
   } 
      function ServiceForm_DateValidations () { 
     this.a0 = new Array("schedDate", "'Date' is not in a valid date format.", 
new Function ("varName", "this.datePattern='d-M-yyyy';  return 
this[varName];"));
    } 
   
  //my form name
  <form name="ServiceSearchForm" method="post" action="/kms30/serviceSearch.do" 
onsubmit="return validateServiceForm(this)">
   
  so it will generate error because the javascript validation will called 
ServiceSearchForm_DateValidations instead of ServiceForm_DateValidations 
   
  In struts 1.1 the function generated will be 
  function DateValidations () { 
     this.a0 = new Array("schedDate", "'Date' is not in a valid date format.", 
new Function ("varName", "this.datePattern='d-M-yyyy';  return 
this[varName];"));
    } 
  without formname, so it is not a problem for the old validation.
  If any one could help / give some advice regarding this matter that would be 
great.
   
  thanks , 
  Adi

       
---------------------------------
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. 

Reply via email to