-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Creating multiple assertions with @ScriptAssert
PostPosted: Tue Sep 06, 2011 2:24 pm 
Newbie

Joined: Tue Sep 06, 2011 2:18 pm
Posts: 3
I have been able to successfully perform cross-field validation via @ScriptAssert, however, I would like to run multiple assertions instead of one. How would I do this?

Current code:
Code:
@ScriptAssert(lang="javascript",script="_this.emailAddress.equals(_this.confirmEmailAddress)",
        message="Your Email Address and Confirm Email Address must match.")     


However, I would like to put in another assertion that would check a zip field only if state is not null. I know I have seen this type of example before, but cannot find it now. Thanks...


Top
 Profile  
 
 Post subject: Re: Creating multiple assertions with @ScriptAssert
PostPosted: Tue Sep 06, 2011 2:26 pm 
Newbie

Joined: Tue Sep 06, 2011 2:18 pm
Posts: 3
This is a Spring MVC application.

Let me know if I should ask this in the Spring forum.

Thanks


Top
 Profile  
 
 Post subject: Re: Creating multiple assertions with @ScriptAssert
PostPosted: Tue Sep 06, 2011 3:00 pm 
Newbie

Joined: Tue Sep 06, 2011 2:18 pm
Posts: 3
I think I have arrived at a solution. I needed to use the @ScriptAssert.List annotation.

Code:
@ScriptAssert.List({
@ScriptAssert(lang="javascript",script="_this.emailAddress.equals(_this.confirmEmailAddress)",
        message="Your Email Address and Confirm Email Address must match."),
        @ScriptAssert(lang="javascript",script="_this.companyName1.equals(_this.companyName2)",
                message="Your Company Names must match.")})       


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.