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
RE: Requiredif error?
Try var-namefieldTest[0]/var-name -Original Message- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Saturday, October 25, 2003 12:21 PM To: Struts Subject: Requiredif error? Hi All, I get the following error when I submit my form using the requiredif: 25 Oct 2003 12:03:13,311 - ERROR org.apache.commons.validator.Validator - reflection: null java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454) at org.apache.commons.validator.Validator.validateField(Validator.java:544) at org.apache.commons.validator.Validator.validate(Validator.java:582) at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152) at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96) at com.caucho.http.security.SecurityFilter.doFilter(SecurityFilter.java:115) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.caucho.server.http.Invocation.service(Invocation.java:315) at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164) at com.caucho.server.TcpConnection.run(TcpConnection.java:139) at java.lang.Thread.run(Thread.java:536) Caused by: java.lang.NullPointerException at org.apache.struts.validator.FieldChecks.validateRequiredIf(FieldChecks.java:200) ... 23 more My config is good: form name=archiveRestoreForm field property=archive depends=requiredif arg0 key=archiveRestoreForm.archiveFile/ var var-namefield[0]/var-name var-valueevent/var-value /var var var-namefield-test[0]/var-name var-valueNOTNULL/var-value /var /field /form If I switch the rule to required all is well. Any help is much appreciated. Greg Hess Software Engineer Wrapped Apps Corporation 275 Michael Cowpland Dr. Suite 201 Ottawa, Ontario K2M 2G2 Tel: (613) 591 -7552 Fax: (613) 591-0523 1 (877) 388-6742 www.wrappedapps.com http://www.wrappedapps.com
Re: requiredif
- Original Message - From: Marc Dugger [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] The new validwhen validation rule, which will be included into the Struts release immediately after the 1.1 release... I am using the nightly build to develop my app and am hoping 1.2 will be release by the time I'm ready to deploy. So far, validwhen is operating as promised. I haven't run into any problems, but you may search the archives to view other opinions. How I can download the nightly build version? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif
http://cvs.apache.org/builds/jakarta-struts/nightly/ Ruben Orta Magan wrote: - Original Message - From: Marc Dugger [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] The new validwhen validation rule, which will be included into the Struts release immediately after the 1.1 release... I am using the nightly build to develop my app and am hoping 1.2 will be release by the time I'm ready to deploy. So far, validwhen is operating as promised. I haven't run into any problems, but you may search the archives to view other opinions. How I can download the nightly build version? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif
Since no one offered an example for requiredIf: In this case either x_Company OR x_First_Name and x_Last_Name are required, so x_First_Name AND x_Last_Name are requiredIf x_Company is NULL, and company is required if either first name OR last name is null. field property=x_First_Name depends=requiredif msg name=requiredif key=errors.requiredif / arg0 key=payment.form.firstName.prompt name=requiredif/ arg1 key=payment.form.firstName.requiredif name=requiredif/ var var-namefield[0]/var-name var-valuex_Company/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field field property=x_Last_Name depends=requiredif msg name=requiredif key=errors.requiredif / arg0 key=payment.form.lastName.prompt name=requiredif/ arg1 key=payment.form.lastName.requiredif name=requiredif/ var var-namefield[0]/var-name var-valuex_Company/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field field property=x_Company depends=requiredif msg name=requiredif key=errors.requiredif / arg0 key=payment.form.companyName.prompt name=requiredif/ arg1 key=payment.form.companyName.requiredif name=requiredif/ var var-namefield[0]/var-name var-valuex_First_Name/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var var var-namefield[1]/var-name var-valuex_Last_Name/var-value /var var var-namefield-test[1]/var-name var-valueNULL/var-value /var var var-namefield-join/var-name var-valueOR/var-value /var /field Greg -Original Message- From: Rhet Behler [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:47 PM To: Struts Users Mailing List Subject: requiredif Has anyone used this in the validation.xml? If so could I see a simple example? If not what are you using validwhen? thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif
My understanding is that 'requiredif' will be deprecated and the use of 'validwhen' is encouraged. Example: field property=emailAddress depends=validwhen arg0 key=userinfo.emailAddress.label/ var var-nametest/var-name var-value((sendNewsletter == null) or (*this* != null))/var-value /var /field -Original Message- From: Rhet Behler [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:47 PM To: Struts Users Mailing List Subject: requiredif Has anyone used this in the validation.xml? If so could I see a simple example? If not what are you using validwhen? thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif
validwhen isn't available in struts 1.1 is it? have you used this or tested it? - Original Message - From: Marc Dugger [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:32 PM Subject: RE: requiredif My understanding is that 'requiredif' will be deprecated and the use of 'validwhen' is encouraged. Example: field property=emailAddress depends=validwhen arg0 key=userinfo.emailAddress.label/ var var-nametest/var-name var-value((sendNewsletter == null) or (*this* != null))/var-value /var /field -Original Message- From: Rhet Behler [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:47 PM To: Struts Users Mailing List Subject: requiredif Has anyone used this in the validation.xml? If so could I see a simple example? If not what are you using validwhen? thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif
The new validwhen validation rule, which will be included into the Struts release immediately after the 1.1 release... I am using the nightly build to develop my app and am hoping 1.2 will be release by the time I'm ready to deploy. So far, validwhen is operating as promised. I haven't run into any problems, but you may search the archives to view other opinions. -Original Message- From: Rhet Behler [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 7:17 PM To: Struts Users Mailing List Subject: Re: requiredif validwhen isn't available in struts 1.1 is it? have you used this or tested it? - Original Message - From: Marc Dugger [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:32 PM Subject: RE: requiredif My understanding is that 'requiredif' will be deprecated and the use of 'validwhen' is encouraged. Example: field property=emailAddress depends=validwhen arg0 key=userinfo.emailAddress.label/ var var-nametest/var-name var-value((sendNewsletter == null) or (*this* != null))/var-value /var /field -Original Message- From: Rhet Behler [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:47 PM To: Struts Users Mailing List Subject: requiredif Has anyone used this in the validation.xml? If so could I see a simple example? If not what are you using validwhen? thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif validator
Oops, sorry, what I wanted to know is about 'requiredWhen'. Erez -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 11:12 AM To: 'Struts Users Mailing List' Subject: requiredif validator Hi, I am using the validator 1.02 that came with Struts 1.1. How do I get the 'requiredif' validator to work? Or is it not included? Thanks, Erez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif validator
On 10/15/2003 01:47 PM Erez Efrati wrote: Oops, sorry, what I wanted to know is about 'requiredWhen'. Erez -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 11:12 AM To: 'Struts Users Mailing List' Subject: requiredif validator Hi, I am using the validator 1.02 that came with Struts 1.1. How do I get the 'requiredif' validator to work? Or is it not included? Thanks, requiredWhen requiredWhen? It's not in validation-rules.xml so I'd say it's an add-on like validateTwoFields. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif and *this*
Requiredif doesn't provide the *this* constant, alas. Validwhen will, and should be available in 1.1.1/1.2 (whatever we call the next release), except that I may do another rewrite before release it, since there's been a lot of suggestions to me to base it on the Commons EL parser rather than doing a brand new one. James -Original Message- From: Chen, Gin [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 11:15 AM To: 'Struts Users Mailing List' Subject: requiredif and *this* The new validwhen will provide a *this* So that you can easily test if 2 fields are equal. Is this available using requiredif? I saw Raible's article regarding this but it requires creating a custom validator. I'm not opposed to doing this but I don't want to introduce new items for maintenance if it is now available directly from Struts. Thanks, -Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif - simple example
The following worked for me. Note that in RC1, the var-name tag values are expected to be field-test[n], not fieldTest[n] and so on The requiredif check was removed because in 1.1RC1, requiredif would break a javascript validator such as mask. I used custom validation instead. field property=prop1 depends=mask!-- removed requiredif -- msg name=requiredif key=app224Form.aForm.prop1.req/ msg name=mask key=app224Form.aForm.prop1.mask/ var var-namemask/var-name var-value${4dig}/var-value /var !--var var-namefield[0]/var-name var-valuefeeExempt/var-value /var var var-namefieldTest[0]/var-name var-valueEQUAL/var-value /var var var-namefieldValue[0]/var-name var-valuetrue/var-value /var var var-namefield[1]/var-name var-valueprop1/var-value /var var var-namefieldTest[1]/var-name var-valueNULL/var-value /var -- You can also check out the Validator doc on the struts documentation. Just expand the struts-documentation webapp that comes with your version of struts, it is under User and Developer Guides. -Kevin --- Brian McSweeney [EMAIL PROTECTED] wrote: Hi all, The validator package works well for me. But I'm trying to use the requiredif and failing. I know there has been previous discussion of this, but I'm trying to a simple validation based on a checkbox so perhaps someone could tell me where I'm going wrong. For example, I want to validate a creditcard, if a checkbox is checked. I currently am trying to do this as follows: form name=myForm field property=creditCard depends=requiredif,creditCard arg0 key=myForm.creditCard/ arg0 name=creditCard key=CreditCard resource=false / arg0 name=requiredif key=A Credit-Card is resource=false / var var-namemyForm.checked/var-name var-valueon/var-value /var /field /form The form name is: myForm The creditcard field is named creditCard The checkbox field is named checked Note that all other types of validation are working correctly for me. Any help would be SO much appreciated. Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif - simple example
Hi Kevin, Thanks for the reply. I'm a little confused by your example though. First off - what does the ${4dig} mean? This won't validate a checkbox, right? Second, you have a lot of stuff commented out. Are these fields getting validated? Finally, if I wanted to just test against a boolean being checked would I do something like the following? field property=prop1 depends=mask msg name=requiredif key=app224Form.aForm.prop1.req/ msg name=mask key=app224Form.aForm.prop1.mask/ var var-namemask/var-name var-value${4dig}/var-value /var var var-namefield-checked[0]/var-name var-valuetrue/var-value /var I'm quite confused! Sorry, Thanks, Brian -Original Message- From: Kevin Robair [mailto:[EMAIL PROTECTED] Sent: 26 June 2003 14:30 To: Struts Users Mailing List Subject: Re: requiredif - simple example The following worked for me. Note that in RC1, the var-name tag values are expected to be field-test[n], not fieldTest[n] and so on The requiredif check was removed because in 1.1RC1, requiredif would break a javascript validator such as mask. I used custom validation instead. field property=prop1 depends=mask!-- removed requiredif -- msg name=requiredif key=app224Form.aForm.prop1.req/ msg name=mask key=app224Form.aForm.prop1.mask/ var var-namemask/var-name var-value${4dig}/var-value /var !--var var-namefield[0]/var-name var-valuefeeExempt/var-value /var var var-namefieldTest[0]/var-name var-valueEQUAL/var-value /var var var-namefieldValue[0]/var-name var-valuetrue/var-value /var var var-namefield[1]/var-name var-valueprop1/var-value /var var var-namefieldTest[1]/var-name var-valueNULL/var-value /var -- You can also check out the Validator doc on the struts documentation. Just expand the struts-documentation webapp that comes with your version of struts, it is under User and Developer Guides. -Kevin --- Brian McSweeney [EMAIL PROTECTED] wrote: Hi all, The validator package works well for me. But I'm trying to use the requiredif and failing. I know there has been previous discussion of this, but I'm trying to a simple validation based on a checkbox so perhaps someone could tell me where I'm going wrong. For example, I want to validate a creditcard, if a checkbox is checked. I currently am trying to do this as follows: form name=myForm field property=creditCard depends=requiredif,creditCard arg0 key=myForm.creditCard/ arg0 name=creditCard key=CreditCard resource=false / arg0 name=requiredif key=A Credit-Card is resource=false / var var-namemyForm.checked/var-name var-valueon/var-value /var /field /form The form name is: myForm The creditcard field is named creditCard The checkbox field is named checked Note that all other types of validation are working correctly for me. Any help would be SO much appreciated. Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif question
--- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var-valueNOTNULL/var-value /var var var-namefield[1]/var-name var-valuephone1/var-value /var var var-namefieldTest[1]/var-name var-valueNOTEQUAL/var-value /var var var-namefieldValue[1]/var-name var-value /var-value You can't define empty values in XML like that because the parser removes the whitespace. I'm not quite how to accomplish this though. David /var var var-namefieldJoin/var-name var-valueOR/var-value /var /field --- Thanks... Mick Knutson --- _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif question
Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var-valueNOTNULL/var-value /var var var-namefield[1]/var-name var-valuephone1/var-value /var var var-namefieldTest[1]/var-name var-valueNOTEQUAL/var-value /var var var-namefieldValue[1]/var-name var-value /var-value /var var var-namefieldJoin/var-name var-valueOR/var-value /var /field --- Thanks... Mick Knutson --- _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: requiredif question
Yes, no matter what I enter, nothing happends at all. It just accepts whatever I enter, or leave blank, and submits just fine. --- Thanks... Mick Knutson --- From: Kevin Robair [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: requiredif question Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT) Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var-valueNOTNULL/var-value /var var var-namefield[1]/var-name var-valuephone1/var-value /var var var-namefieldTest[1]/var-name var-valueNOTEQUAL/var-value /var var var-namefieldValue[1]/var-name var-value /var-value /var var var-namefieldJoin/var-name var-valueOR/var-value /var /field --- Thanks... Mick Knutson --- _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif question
I'm having a similar problem. All I'm trying to do is have a 'required' condition for 2 fields of my form. Mine submits just fine when I leave it blank as well. I posted my code here yesterday, but nobody was able to help me. If you figure this out, I'd appreciate it if you let me know what the problem is. I'll do the same! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:26 PM To: [EMAIL PROTECTED] Subject: Re: requiredif question Yes, no matter what I enter, nothing happends at all. It just accepts whatever I enter, or leave blank, and submits just fine. --- Thanks... Mick Knutson --- From: Kevin Robair [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: requiredif question Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT) Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var-valueNOTNULL/var-value /var var var-namefield[1]/var-name var-valuephone1/var-value /var var var-namefieldTest[1]/var-name var-valueNOTEQUAL/var-value /var var var-namefieldValue[1]/var-name var-value /var-value /var var var-namefieldJoin/var-name var-valueOR/var-value /var /field --- Thanks... Mick Knutson --- _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif question
I did not see yours. Can you post your code again? --- Thanks... Mick Knutson --- From: Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: requiredif question Date: Wed, 25 Jun 2003 13:26:48 -0400 I'm having a similar problem. All I'm trying to do is have a 'required' condition for 2 fields of my form. Mine submits just fine when I leave it blank as well. I posted my code here yesterday, but nobody was able to help me. If you figure this out, I'd appreciate it if you let me know what the problem is. I'll do the same! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:26 PM To: [EMAIL PROTECTED] Subject: Re: requiredif question Yes, no matter what I enter, nothing happends at all. It just accepts whatever I enter, or leave blank, and submits just fine. --- Thanks... Mick Knutson --- From: Kevin Robair [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: requiredif question Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT) Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var-valueNOTNULL/var-value /var var var-namefield[1]/var-name var-valuephone1/var-value /var var var-namefieldTest[1]/var-name var-valueNOTEQUAL/var-value /var var var-namefieldValue[1]/var-name var-value /var-value /var var var-namefieldJoin/var-name var-valueOR/var-value /var /field --- Thanks... Mick Knutson --- _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: requiredif question
Here's my struts-config and my validation.xml. I've also attached them, if it's easier to look at that way. I've only shown parts of my struts-config.xml, enough to show one example action that isn't validating right. ___ Struts-Config snippets: form-beans form-bean name=ansm type=com.moog.us.app.ans.data.AnsmItem/ form-bean name=ansa type=com.moog.us.app.ans.data.AnsaItem/ /form-beans action path=/AddFormat type=com.moog.us.app.ans.action.AddANSM validate=true name=ansm scope=request input=tiles.addFormat/ controller processorClass=com.moog.us.struts.AppRequestProcessor / message-resources parameter=ApplicationResources/ plug-in className=com.moog.us.struts.AppStartupPlugin/ plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=moduleAware value=true / set-property property=definitions-parser-validate value=true / /plug-in plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in ___ Validation.xml: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_0.dtd; form-validation global /global formset form name=ansm field property=numberType depends=required arg0 key=app.label.numberType/ /field field property=typeDesc depends=required arg0 key=app.label.numberType/ /field /form /formset /form-validation If I should send any other files, let me know. Any input would be great, thanks! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:32 PM To: [EMAIL PROTECTED] Subject: RE: requiredif question I did not see yours. Can you post your code again? --- Thanks... Mick Knutson --- From: Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: requiredif question Date: Wed, 25 Jun 2003 13:26:48 -0400 I'm having a similar problem. All I'm trying to do is have a 'required' condition for 2 fields of my form. Mine submits just fine when I leave it blank as well. I posted my code here yesterday, but nobody was able to help me. If you figure this out, I'd appreciate it if you let me know what the problem is. I'll do the same! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:26 PM To: [EMAIL PROTECTED] Subject: Re: requiredif question Yes, no matter what I enter, nothing happends at all. It just accepts whatever I enter, or leave blank, and submits just fine. --- Thanks... Mick Knutson --- From: Kevin Robair [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: requiredif question Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT) Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var-valueNOTNULL/var-value /var var var-namefield[1]/var-name var-valuephone1/var-value /var var var-namefieldTest[1]/var-name
RE: requiredif question
Are you extending ValidatorForm? sandeep --- Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] wrote: Here's my struts-config and my validation.xml. I've also attached them, if it's easier to look at that way. I've only shown parts of my struts-config.xml, enough to show one example action that isn't validating right. ___ Struts-Config snippets: form-beans form-bean name=ansm type=com.moog.us.app.ans.data.AnsmItem/ form-bean name=ansa type=com.moog.us.app.ans.data.AnsaItem/ /form-beans action path=/AddFormat type=com.moog.us.app.ans.action.AddANSM validate=true name=ansm scope=request input=tiles.addFormat/ controller processorClass=com.moog.us.struts.AppRequestProcessor / message-resources parameter=ApplicationResources/ plug-in className=com.moog.us.struts.AppStartupPlugin/ plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=moduleAware value=true / set-property property=definitions-parser-validate value=true / /plug-in plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in ___ Validation.xml: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_0.dtd; form-validation global /global formset form name=ansm field property=numberType depends=required arg0 key=app.label.numberType/ /field field property=typeDesc depends=required arg0 key=app.label.numberType/ /field /form /formset /form-validation If I should send any other files, let me know. Any input would be great, thanks! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:32 PM To: [EMAIL PROTECTED] Subject: RE: requiredif question I did not see yours. Can you post your code again? --- Thanks... Mick Knutson --- From: Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: requiredif question Date: Wed, 25 Jun 2003 13:26:48 -0400 I'm having a similar problem. All I'm trying to do is have a 'required' condition for 2 fields of my form. Mine submits just fine when I leave it blank as well. I posted my code here yesterday, but nobody was able to help me. If you figure this out, I'd appreciate it if you let me know what the problem is. I'll do the same! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:26 PM To: [EMAIL PROTECTED] Subject: Re: requiredif question Yes, no matter what I enter, nothing happends at all. It just accepts whatever I enter, or leave blank, and submits just fine. --- Thanks... Mick Knutson --- From: Kevin Robair [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: requiredif question Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT) Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type/ var var-namefield[0]/var-name var-valuephone1/var-value /var var var-namefieldTest[0]/var-name var
RE: requiredif question
I extend org.apache.struts.validator.ValidatorActionForm and all my normal validation works except the requiredif. --- Thanks... Mick Knutson --- From: Sandeep Takhar [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: requiredif question Date: Wed, 25 Jun 2003 15:21:50 -0700 (PDT) Are you extending ValidatorForm? sandeep --- Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] wrote: Here's my struts-config and my validation.xml. I've also attached them, if it's easier to look at that way. I've only shown parts of my struts-config.xml, enough to show one example action that isn't validating right. ___ Struts-Config snippets: form-beans form-bean name=ansm type=com.moog.us.app.ans.data.AnsmItem/ form-bean name=ansa type=com.moog.us.app.ans.data.AnsaItem/ /form-beans action path=/AddFormat type=com.moog.us.app.ans.action.AddANSM validate=true name=ansm scope=request input=tiles.addFormat/ controller processorClass=com.moog.us.struts.AppRequestProcessor / message-resources parameter=ApplicationResources/ plug-in className=com.moog.us.struts.AppStartupPlugin/ plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=moduleAware value=true / set-property property=definitions-parser-validate value=true / /plug-in plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in ___ Validation.xml: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_0.dtd; form-validation global /global formset form name=ansm field property=numberType depends=required arg0 key=app.label.numberType/ /field field property=typeDesc depends=required arg0 key=app.label.numberType/ /field /form /formset /form-validation If I should send any other files, let me know. Any input would be great, thanks! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:32 PM To: [EMAIL PROTECTED] Subject: RE: requiredif question I did not see yours. Can you post your code again? --- Thanks... Mick Knutson --- From: Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: requiredif question Date: Wed, 25 Jun 2003 13:26:48 -0400 I'm having a similar problem. All I'm trying to do is have a 'required' condition for 2 fields of my form. Mine submits just fine when I leave it blank as well. I posted my code here yesterday, but nobody was able to help me. If you figure this out, I'd appreciate it if you let me know what the problem is. I'll do the same! - Keith -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:26 PM To: [EMAIL PROTECTED] Subject: Re: requiredif question Yes, no matter what I enter, nothing happends at all. It just accepts whatever I enter, or leave blank, and submits just fine. --- Thanks... Mick Knutson --- From: Kevin Robair [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: requiredif question Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT) Just a hunch: For Struts 1.1RC1 , the varnames should be: field-test[x] field-join etc... In 1.1RC2, they are fieldTest[n] fieldJoin etc BTW, I am unsure what you mean by: does not seem to operate at all Are there any errors or exceptions in the log? If the form validates no matter what you enter, and there are no errors in the log, then it is possibly a configuration problem. You could try a simpler validation, in place of this one just to make sure it is doing something. Then, remove the NOTNULL check, and see if the NOTEQUAL alone works. -Kevin --- Mick Knutson [EMAIL PROTECTED] wrote: I have the following code that does not seem to operate at all. I want phone1type to be a required field _if_ the phone1 attribute is _not_ field property=phone1type depends=requiredif arg0 key=form.phone1type
RE: RequiredIf Example Request
Sorry I am not following you. I am trying to to use the 'requiredif' validation not 'required' validation. I dont have xml defining the field. Just what I had posted in the previous message to illustrate my problem. I am currently looking at the code of requiredif to see if its functioning properly. You say to use required, mycheck. But I cant require the field. I need to require it conditionally based on another field in the form. That is why I want to use requiredif. Based on whether a field is true or false, validate some other fields, kind of thing... As for as the code for RequiredIf, it doesnt seem to me to handle EQUALS well. boolean required = false; ... ... ... if (dependTest.equals(FIELD_TEST_EQUAL)) { this_required = dependTestValue.equalsIgnoreCase(dependVal); } ... ... if (required) { if ((value != null) (value.length() 0)) { return true; } else { errors.add(field.getKey(), Resources.getActionError(request, va, field)); return false; } } } No where does it seem to compare the xml value and the value on the actual form. If you have any other suggestions or can clarify, please do... Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Dennis Muhlestein [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 3:39 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request I just barely ran into this problem. Seems that all the field checks are run. Checking the Validator example (TowFieldCheck) in the struts docs (1.1b3), It seems that if the value is null, you should let it pass as accepted. The xml defining the field is the one that should specify that the field is required. id: required,mycheck Then it becomes possible to have an optional field. -Dennis On Thu, 2003-01-23 at 14:33, Weber, Jeremy wrote: Yes, but I would think that it would only be run after the first validation (the requiredif) runs. Is that not a correct assumption? Do I need to add anything to the exists validation to make it so? In your example if the requiredif fails, does it still try to run the next validations? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 4:20 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request I'm not sure exists is a standard validation rule. Did you define it yourself? -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: RequiredIf Example Request Thank you , thank you, thank you! I misspoke when I said checkboxs, its a radio button, like this... tr td class=mandatorybean:message key=appserver.usesecure.displayname//td tdhtml:radio property=useSecure value=true onclick=showSecureOptions('true');/ Yesbr html:radio property=useSecure value=false onclick=showSecureOptions('false');/ No/td /tr field property=sslKeyStore depends=requiredif,exists arg0 key=appserver.sslkeystore.displayname/ var var-namefield[0]/var-name var-valueuseSecure/var-value /var var var-namefield-test[0]/var-name var-valueEQUAL/var-value /var var var-namefield-value[0]/var-name var-valuetrue/var-value /var /field From what I can tell, this looks like it will work... But it doesnt. However, this is the kicker... If I remove exists from depends, it acts as it should. Now I figured that exists would only be called if requiredif passed. Any thoughts? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 3:26 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request If you're just requesting an example of something, here's what I'm currently using: field property=studentId depends=requiredif,integer,minlength,maxlength msg name=requiredif key=errors.msg.studentIDorNameRequired/ msg name=integer key=errors.msg.invalidStudentID/ msg name=minlength key=errors.msg.invalidStudentID/ msg name=maxlength key=errors.msg.invalidStudentID/ var var-nameminlength/var-name var-value9/var
RE: RequiredIf Example Request
I just barely ran into this problem. Seems that all the field checks are run. Checking the Validator example (TowFieldCheck) in the struts docs (1.1b3), It seems that if the value is null, you should let it pass as accepted. The xml defining the field is the one that should specify that the field is required. id: required,mycheck Then it becomes possible to have an optional field. -Dennis On Thu, 2003-01-23 at 14:33, Weber, Jeremy wrote: Yes, but I would think that it would only be run after the first validation (the requiredif) runs. Is that not a correct assumption? Do I need to add anything to the exists validation to make it so? In your example if the requiredif fails, does it still try to run the next validations? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 4:20 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request I'm not sure exists is a standard validation rule. Did you define it yourself? -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: RequiredIf Example Request Thank you , thank you, thank you! I misspoke when I said checkboxs, its a radio button, like this... tr td class=mandatorybean:message key=appserver.usesecure.displayname//td tdhtml:radio property=useSecure value=true onclick=showSecureOptions('true');/ Yesbr html:radio property=useSecure value=false onclick=showSecureOptions('false');/ No/td /tr field property=sslKeyStore depends=requiredif,exists arg0 key=appserver.sslkeystore.displayname/ var var-namefield[0]/var-name var-valueuseSecure/var-value /var var var-namefield-test[0]/var-name var-valueEQUAL/var-value /var var var-namefield-value[0]/var-name var-valuetrue/var-value /var /field From what I can tell, this looks like it will work... But it doesnt. However, this is the kicker... If I remove exists from depends, it acts as it should. Now I figured that exists would only be called if requiredif passed. Any thoughts? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 3:26 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request If you're just requesting an example of something, here's what I'm currently using: field property=studentId depends=requiredif,integer,minlength,maxlength msg name=requiredif key=errors.msg.studentIDorNameRequired/ msg name=integer key=errors.msg.invalidStudentID/ msg name=minlength key=errors.msg.invalidStudentID/ msg name=maxlength key=errors.msg.invalidStudentID/ var var-nameminlength/var-name var-value9/var-value /var var var-namemaxlength/var-name var-value9/var-value /var var var-namefield[0]/var-name var-valuelastName/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field This makes studentId required if lastName is NULL. If I also wanted to add a requirement to make studentId required if firstName was null, I'd add the following to the above: var var-namefield[1]/var-name var-valuelastName/var-value /var var var-namefield-test[1]/var-name var-valueNULL/var-value /var The conditions you can have are NULL, NOTNULL, and EQUAL. I haven't used this with checkboxes yet, but I think you'd probably have each of your three fields use requiredif, and use something like the following to make it depend on the checkbox: var var-namefield[0]/var-name var-valuecheckboxFieldName/var-value /var var var-namefield-test[0]/var-name var-valueNOTNULL/var-value /var The fact that the example was using indicies screwed me up for a while too until I took a look at the source code for FieldChecks. GM -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 12:57 PM To: 'Struts Users Mailing List' (E-mail) Subject
RE: RequiredIf Example Request
If you're just requesting an example of something, here's what I'm currently using: field property=studentId depends=requiredif,integer,minlength,maxlength msg name=requiredif key=errors.msg.studentIDorNameRequired/ msg name=integer key=errors.msg.invalidStudentID/ msg name=minlength key=errors.msg.invalidStudentID/ msg name=maxlength key=errors.msg.invalidStudentID/ var var-nameminlength/var-name var-value9/var-value /var var var-namemaxlength/var-name var-value9/var-value /var var var-namefield[0]/var-name var-valuelastName/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field This makes studentId required if lastName is NULL. If I also wanted to add a requirement to make studentId required if firstName was null, I'd add the following to the above: var var-namefield[1]/var-name var-valuelastName/var-value /var var var-namefield-test[1]/var-name var-valueNULL/var-value /var The conditions you can have are NULL, NOTNULL, and EQUAL. I haven't used this with checkboxes yet, but I think you'd probably have each of your three fields use requiredif, and use something like the following to make it depend on the checkbox: var var-namefield[0]/var-name var-valuecheckboxFieldName/var-value /var var var-namefield-test[0]/var-name var-valueNOTNULL/var-value /var The fact that the example was using indicies screwed me up for a while too until I took a look at the source code for FieldChecks. GM -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 12:57 PM To: 'Struts Users Mailing List' (E-mail) Subject: RequiredIf Example Request I requested this before and have not recieved a response...:( Any takers out there? Currently I am having a heck of time figuring out how to make this work... I have checked out all the online examples, but I am unclear as to what this stuff means... If you have this in your struts-config.xml... form-bean name=dependentlistForm type=org.apache.struts.webapp.validator.forms.ValidatorForm form-property name=dependents type=org.apache.struts.webapp.validator.Dependent[] initial={'','','','','','','','','','',''}/ form-property name=insureDependents type=java.lang.Boolean initial=false/ /form-bean My form properties look like... form-bean name=InstallConfigurationFormBean type=com.vendorsite.install.beans.InstallConfigurationFormBean/ So I am missing the type and initial fields. Can anybody help me see the light? I need a checkbox to control whether or not 3 addiotional text fields are required. Thanks, Jeremy Weber [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: RequiredIf Example Request
Thank you , thank you, thank you! I misspoke when I said checkboxs, its a radio button, like this... tr td class=mandatorybean:message key=appserver.usesecure.displayname//td tdhtml:radio property=useSecure value=true onclick=showSecureOptions('true');/ Yesbr html:radio property=useSecure value=false onclick=showSecureOptions('false');/ No/td /tr field property=sslKeyStore depends=requiredif,exists arg0 key=appserver.sslkeystore.displayname/ var var-namefield[0]/var-name var-valueuseSecure/var-value /var var var-namefield-test[0]/var-name var-valueEQUAL/var-value /var var var-namefield-value[0]/var-name var-valuetrue/var-value /var /field From what I can tell, this looks like it will work... But it doesnt. However, this is the kicker... If I remove exists from depends, it acts as it should. Now I figured that exists would only be called if requiredif passed. Any thoughts? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 3:26 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request If you're just requesting an example of something, here's what I'm currently using: field property=studentId depends=requiredif,integer,minlength,maxlength msg name=requiredif key=errors.msg.studentIDorNameRequired/ msg name=integer key=errors.msg.invalidStudentID/ msg name=minlength key=errors.msg.invalidStudentID/ msg name=maxlength key=errors.msg.invalidStudentID/ var var-nameminlength/var-name var-value9/var-value /var var var-namemaxlength/var-name var-value9/var-value /var var var-namefield[0]/var-name var-valuelastName/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field This makes studentId required if lastName is NULL. If I also wanted to add a requirement to make studentId required if firstName was null, I'd add the following to the above: var var-namefield[1]/var-name var-valuelastName/var-value /var var var-namefield-test[1]/var-name var-valueNULL/var-value /var The conditions you can have are NULL, NOTNULL, and EQUAL. I haven't used this with checkboxes yet, but I think you'd probably have each of your three fields use requiredif, and use something like the following to make it depend on the checkbox: var var-namefield[0]/var-name var-valuecheckboxFieldName/var-value /var var var-namefield-test[0]/var-name var-valueNOTNULL/var-value /var The fact that the example was using indicies screwed me up for a while too until I took a look at the source code for FieldChecks. GM -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 12:57 PM To: 'Struts Users Mailing List' (E-mail) Subject: RequiredIf Example Request I requested this before and have not recieved a response...:( Any takers out there? Currently I am having a heck of time figuring out how to make this work... I have checked out all the online examples, but I am unclear as to what this stuff means... If you have this in your struts-config.xml... form-bean name=dependentlistForm type=org.apache.struts.webapp.validator.forms.ValidatorForm form-property name=dependents type=org.apache.struts.webapp.validator.Dependent[] initial={'','','','','','','','','','',''}/ form-property name=insureDependents type=java.lang.Boolean initial=false/ /form-bean My form properties look like... form-bean name=InstallConfigurationFormBean type=com.vendorsite.install.beans.InstallConfigurationFormBean/ So I am missing the type and initial fields. Can anybody help me see the light? I need a checkbox to control whether or not 3 addiotional text fields are required. Thanks, Jeremy Weber [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED
RE: RequiredIf Example Request
I'm not sure exists is a standard validation rule. Did you define it yourself? -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: RequiredIf Example Request Thank you , thank you, thank you! I misspoke when I said checkboxs, its a radio button, like this... tr td class=mandatorybean:message key=appserver.usesecure.displayname//td tdhtml:radio property=useSecure value=true onclick=showSecureOptions('true');/ Yesbr html:radio property=useSecure value=false onclick=showSecureOptions('false');/ No/td /tr field property=sslKeyStore depends=requiredif,exists arg0 key=appserver.sslkeystore.displayname/ var var-namefield[0]/var-name var-valueuseSecure/var-value /var var var-namefield-test[0]/var-name var-valueEQUAL/var-value /var var var-namefield-value[0]/var-name var-valuetrue/var-value /var /field From what I can tell, this looks like it will work... But it doesnt. However, this is the kicker... If I remove exists from depends, it acts as it should. Now I figured that exists would only be called if requiredif passed. Any thoughts? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 3:26 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request If you're just requesting an example of something, here's what I'm currently using: field property=studentId depends=requiredif,integer,minlength,maxlength msg name=requiredif key=errors.msg.studentIDorNameRequired/ msg name=integer key=errors.msg.invalidStudentID/ msg name=minlength key=errors.msg.invalidStudentID/ msg name=maxlength key=errors.msg.invalidStudentID/ var var-nameminlength/var-name var-value9/var-value /var var var-namemaxlength/var-name var-value9/var-value /var var var-namefield[0]/var-name var-valuelastName/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field This makes studentId required if lastName is NULL. If I also wanted to add a requirement to make studentId required if firstName was null, I'd add the following to the above: var var-namefield[1]/var-name var-valuelastName/var-value /var var var-namefield-test[1]/var-name var-valueNULL/var-value /var The conditions you can have are NULL, NOTNULL, and EQUAL. I haven't used this with checkboxes yet, but I think you'd probably have each of your three fields use requiredif, and use something like the following to make it depend on the checkbox: var var-namefield[0]/var-name var-valuecheckboxFieldName/var-value /var var var-namefield-test[0]/var-name var-valueNOTNULL/var-value /var The fact that the example was using indicies screwed me up for a while too until I took a look at the source code for FieldChecks. GM -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 12:57 PM To: 'Struts Users Mailing List' (E-mail) Subject: RequiredIf Example Request I requested this before and have not recieved a response...:( Any takers out there? Currently I am having a heck of time figuring out how to make this work... I have checked out all the online examples, but I am unclear as to what this stuff means... If you have this in your struts-config.xml... form-bean name=dependentlistForm type=org.apache.struts.webapp.validator.forms.ValidatorForm form-property name=dependents type=org.apache.struts.webapp.validator.Dependent[] initial={'','','','','','','','','','',''}/ form-property name=insureDependents type=java.lang.Boolean initial=false/ /form-bean My form properties look like... form-bean name=InstallConfigurationFormBean type=com.vendorsite.install.beans.InstallConfigurationFormBean/ So I am missing the type and initial fields. Can anybody help me see the light? I need a checkbox to control whether or not 3 addiotional text fields are required. Thanks, Jeremy Weber [EMAIL PROTECTED] -- To unsubscribe
RE: RequiredIf Example Request
Yes, but I would think that it would only be run after the first validation (the requiredif) runs. Is that not a correct assumption? Do I need to add anything to the exists validation to make it so? In your example if the requiredif fails, does it still try to run the next validations? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 4:20 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request I'm not sure exists is a standard validation rule. Did you define it yourself? -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: RequiredIf Example Request Thank you , thank you, thank you! I misspoke when I said checkboxs, its a radio button, like this... tr td class=mandatorybean:message key=appserver.usesecure.displayname//td tdhtml:radio property=useSecure value=true onclick=showSecureOptions('true');/ Yesbr html:radio property=useSecure value=false onclick=showSecureOptions('false');/ No/td /tr field property=sslKeyStore depends=requiredif,exists arg0 key=appserver.sslkeystore.displayname/ var var-namefield[0]/var-name var-valueuseSecure/var-value /var var var-namefield-test[0]/var-name var-valueEQUAL/var-value /var var var-namefield-value[0]/var-name var-valuetrue/var-value /var /field From what I can tell, this looks like it will work... But it doesnt. However, this is the kicker... If I remove exists from depends, it acts as it should. Now I figured that exists would only be called if requiredif passed. Any thoughts? Jeremy Weber [EMAIL PROTECTED] -Original Message- From: Greg Murray [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 3:26 PM To: Struts Users Mailing List Subject: RE: RequiredIf Example Request If you're just requesting an example of something, here's what I'm currently using: field property=studentId depends=requiredif,integer,minlength,maxlength msg name=requiredif key=errors.msg.studentIDorNameRequired/ msg name=integer key=errors.msg.invalidStudentID/ msg name=minlength key=errors.msg.invalidStudentID/ msg name=maxlength key=errors.msg.invalidStudentID/ var var-nameminlength/var-name var-value9/var-value /var var var-namemaxlength/var-name var-value9/var-value /var var var-namefield[0]/var-name var-valuelastName/var-value /var var var-namefield-test[0]/var-name var-valueNULL/var-value /var /field This makes studentId required if lastName is NULL. If I also wanted to add a requirement to make studentId required if firstName was null, I'd add the following to the above: var var-namefield[1]/var-name var-valuelastName/var-value /var var var-namefield-test[1]/var-name var-valueNULL/var-value /var The conditions you can have are NULL, NOTNULL, and EQUAL. I haven't used this with checkboxes yet, but I think you'd probably have each of your three fields use requiredif, and use something like the following to make it depend on the checkbox: var var-namefield[0]/var-name var-valuecheckboxFieldName/var-value /var var var-namefield-test[0]/var-name var-valueNOTNULL/var-value /var The fact that the example was using indicies screwed me up for a while too until I took a look at the source code for FieldChecks. GM -Original Message- From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 12:57 PM To: 'Struts Users Mailing List' (E-mail) Subject: RequiredIf Example Request I requested this before and have not recieved a response...:( Any takers out there? Currently I am having a heck of time figuring out how to make this work... I have checked out all the online examples, but I am unclear as to what this stuff means... If you have this in your struts-config.xml... form-bean name=dependentlistForm type=org.apache.struts.webapp.validator.forms.ValidatorForm form-property name=dependents type=org.apache.struts.webapp.validator.Dependent[] initial