requiredif validation challenge
I use Struts 1.1 and tried to add the patch for the requiredif validator in validator-rules.xml. Following is the code that I added in the validation.xml for the form. The form has 2 fields and only one of them can be filled inorder to perform a search. field property=acctID depends=requiredif, mask arg0 key=csc.prompt.acctid/ msg name=requiredif key=errors.requiredif/ var var-namefield[0]/var-name var-valueuserID/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field field property=userID depends=requiredif, mask arg0 key=csc.prompt.userid/ msg name=requiredif key=errors.requiredif/ var var-namefield[0]/var-name var-valueacctID/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field It seems like inspite of the above, it still doesnt seem to validate requiredif validator and proceeds with the submit anyway. Can someone guide me? Clark - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing
RE: requiredif validation challenge
Hi Clark, The following is similar validation in struts 1.1 final release working fine, for the case first field is necessary when second field is null, otherwise one of the two shall be available. Do not bother about additional condition of page attribute of page. It is just show how to use two fields in required if. The error your code is in in var-name change from field-test[0] to fieldTest[0] in final release of struts 1.1 can find this in struts validation doc. Hope this will help -Udaya formset form name=forgotForm field property=username depends=requiredif arg0 key=errors.usernameorpassword/ var var-namefield[0]/var-name var-valuecurrentPage/var-value /var var var-namefieldTest[0]/var-name var-valueEQUAL/var-value /var var var-namefieldValue[0]/var-name var-value1/var-value /var var var-namefield[1]/var-name var-valuedomain/var-value /var var var-namefieldTest[1]/var-name var-valueNULL/var-value /var var var-namefieldJoin/var-name var-valueAND/var-value /var /field field property=domain depends=mask arg0 key=form.domainname/ msg name=mask key=errors.domain.invalid/ var var-namemask/var-name var-value^[a-zA-Z0-9]+([-.]*[a-zA-Z0-9])*$/var-value /var /field /form /formset -Original Message- From: Clark Kent [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 12:01 PM To: Struts Users Mailing List Subject: requiredif validation challenge I use Struts 1.1 and tried to add the patch for the requiredif validator in validator-rules.xml. Following is the code that I added in the validation.xml for the form. The form has 2 fields and only one of them can be filled inorder to perform a search. field property=acctID depends=requiredif, mask arg0 key=csc.prompt.acctid/ msg name=requiredif key=errors.requiredif/ var var-namefield[0]/var-name var-valueuserID/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field field property=userID depends=requiredif, mask arg0 key=csc.prompt.userid/ msg name=requiredif key=errors.requiredif/ var var-namefield[0]/var-name var-valueacctID/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field It seems like inspite of the above, it still doesnt seem to validate requiredif validator and proceeds with the submit anyway. Can someone guide me? Clark - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif validation challenge
Hi Udaya, Thanks for the corrections. I have just found out that I am missing the public static boolean validateRequiredIf( ) in the struts-validator.java class which should contain the java functionality to take care of requiredif validator. So it seems like this patch needs to be added onto the class file. Clark Udaya Allu [EMAIL PROTECTED] wrote: Hi Clark, The following is similar validation in struts 1.1 final release working fine, for the case first field is necessary when second field is null, otherwise one of the two shall be available. Do not bother about additional condition of page attribute of page. It is just show how to use two fields in required if. The error your code is in in var-name change from field-test[0] to fieldTest[0] in final release of struts 1.1 can find this in struts validation doc. Hope this will help -Udaya field[0] currentPage fieldTest[0] EQUAL fieldValue[0] 1 field[1] domain fieldTest[1] NULL fieldJoin AND mask ^[a-zA-Z0-9]+([-.]*[a-zA-Z0-9])*$ -Original Message- From: Clark Kent [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 12:01 PM To: Struts Users Mailing List Subject: requiredif validation challenge I use Struts 1.1 and tried to add the patch for the requiredif validator in validator-rules.xml. Following is the code that I added in the validation.xml for the form. The form has 2 fields and only one of them can be filled inorder to perform a search. field[0] userID field-test[0] NULL field[0] acctID field-test[0] NULL It seems like inspite of the above, it still doesnt seem to validate requiredif validator and proceeds with the submit anyway. Can someone guide me? Clark - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing