-->
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.  [ 5 posts ] 
Author Message
 Post subject: Different validation groups for different JSF actions?
PostPosted: Mon Nov 15, 2010 4:05 pm 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
Hi,

Is it possible to somehow use validation groups to have different validation for different JSF actions?

I have the case where I want stuff in fields stored away in the model (and therefore validated) when I use command links from a datatable to switch between entities I edit. But how can I handle the "new entity" case where all my fields are blank when I click a command link? I'd prefer not having to write all built-in-constraints to versions that take into account e.g. the entity ID.


Top
 Profile  
 
 Post subject: Re: Different validation groups for different JSF actions?
PostPosted: Tue Nov 16, 2010 9:06 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
I think groups is the way forward. You could have a Edit group and a New group. Depending on your action you can then validate the appropriate group.

--Hardy


Top
 Profile  
 
 Post subject: Re: Different validation groups for different JSF actions?
PostPosted: Tue Nov 16, 2010 9:12 am 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
hardy.ferentschik wrote:
I think groups is the way forward. You could have a Edit group and a New group. Depending on your action you can then validate the appropriate group.


It's the "depending on your action"-part which is tricky because how can I do that while still maintaining the automatic connection to the JSF controls? Sure I could do different validation in different actions but then I had to manually bind back the different validation messages to the correct JSF controls, right? (and make sure that no automatic validation is done in the JSF layer)

Tack på förhand,
-Nik


Top
 Profile  
 
 Post subject: Re: Different validation groups for different JSF actions?
PostPosted: Tue Nov 16, 2010 9:27 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Unfortunately, I am not so familiar with JSF and how exactly Bean Validation gets integrated. This seems to be more a question for a JSF forum. Have you tried there.

If you find a solution it would be great if you could post it here as well ;-)

--Hardy


Top
 Profile  
 
 Post subject: Re: Different validation groups for different JSF actions?
PostPosted: Tue Nov 16, 2010 9:41 am 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
hardy.ferentschik wrote:
Unfortunately, I am not so familiar with JSF and how exactly Bean Validation gets integrated. This seems to be more a question for a JSF forum. Have you tried there.

If you find a solution it would be great if you could post it here as well ;-)

--Hardy


Thanks. Posted here but the forum didn't appear that active.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.