This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF 2 button doesn't work on the same form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2 button doesn Watch "JSF 2 button doesn New topic
Author

JSF 2 button doesn't work on the same form

shivangi redkar
Greenhorn

Joined: May 16, 2011
Posts: 2


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

In JSF, anything that fails validation will suppress the action process. That's a fundamental design aspect of JSF designed to ensure that only "good" data is posted to the backing bean before an action can execute.

You want to have your cake (non-required items) and eat it (requiring them) too and that doesn't work.

However, looking at your example, I think a different approach will serve.

Right now, you appear to have the entire view wrapped in one big form, even thought the edit and delete sections appear to both be independent of each other. If you split the page definition into 2 forms - one for the edit part and one for the delete part, that would eliminate your problem. Only one form can be submitted - the one that contains the commandButton that the user clicked on. And validation only applies to the submitted form, not to any other form on the page.


Customer surveys are for companies who didn't pay proper attention to begin with.
shivangi redkar
Greenhorn

Joined: May 16, 2011
Posts: 2
thank you Tim but main goal is to have it in the single form itself. is there a way out may be by using rich faces or something
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

Why should it be a "goal" to have everything in one form? A form is simply a collection of objects submitted as a unit and has no graphical characteristics other than the standard XML limitations of nesting elements. The user won't see the difference.
 
Don't get me started about those stupid light bulbs.
 
subject: JSF 2 button doesn't work on the same form
 
Similar Threads
Custom validation ignored
Strange behavior with reRender attribute
Action Event
On a button click need to load a select one menu with required="true" to some components
JSF Page Problem