• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF 2 button doesn't work on the same form

 
shivangi redkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shivangi redkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic