开发者

Seam: Reset form validation after modalpanel closes

Im struggling with the following problem:

  • I have a modalPanel for adding a new person on my Richfaces view
  • I have two buttons "Save" and "Cancel"
  • Some input fields are required with required="true" attribute on h:inputText component
  • when I leave one or more required fields empty and cancel the form/modalpanel, the modalpanel closes
  • When I now want to add a new person, I instantiate a new Person object on my backing bean, reRender the elements in the modalPanel.
  • ModalPanel opens up again
  • Sometime it happens, that the failed validation on my first attempt to create a new person impeded the reRendering of the validation of my modalPanel input fields
  • I see the new empty fields fr开发者_运维技巧om my new person object, but the view has the validation error messages from the last attempt?

So, how can I make sure to reset all backend logic, form and buttons by clicking the "Add Person" button?

Thank you


You can start a new conversation when you add new person. Mark the method with @Begin. This way it will disregard everything that happened in the previous conversation.

Then when you push the save button, you can mark that action with @End
The cancel button can and should be marked with @End(beforeRedirect=true) (beforeRedirect=true) is optional, but can be helpful

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜