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 2005/03/29 16:47:30 UTC

DO NOT REPLY [Bug 34224] New: - validWhen not working

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34224>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34224

           Summary: validWhen not working
           Product: Struts
           Version: 1.2.4
          Platform: Other
        OS/Version: Windows NT
            Status: NEW
          Severity: major
          Priority: P1
         Component: Validator Framework
        AssignedTo: dev@struts.apache.org
        ReportedBy: Dileep.Tharoor@rbs.co.uk


I have a text field which need to be validated against a dropdown. Basically, 
if textfield holds any value, then drop down should also be not null. So 
effectively, it has to either both null or both non-null values. you can see 
the code as below in validation.xml
<form name="/viewUser">
			<field property="merchantId" depends="validwhen">	
		
				<arg0 key="label.user.merchantId"/>
				<arg1 key="label.permission.level"/>
		        <var>
		          <var-name>test</var-name>
		          <var-value>( ((merchantLevId == null) and (*this* == 
null)) or ((merchantLevId != null) and (*this* != null)) )</var-value>
		        </var>
      		</field>
		</form>
 
The first validation  (merchantLevId == null) and (*this* == null)) works just 
fine. ie if I dont enter any value and dont select anything from the dropdown, 
validation is successful.

But the second part on its own also does not work - ((merchantLevId != null) 
and (*this* != null)). If I enter some value for merchantId and select 
something from dropdown, it still comes with the error message - This should 
pass

Now, interestingly if I only enter merchandID and leave the drop down null, it 
validates successfully - This should fail

Also, there is no enough documentation for this

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org