9 Replies Latest reply on Aug 26, 2009 6:20 AM by Dmitri Ilyin

    Help! Very BASIC JSF question!!

    Dmitri Ilyin Newbie

      Hi all,

      i have to implement very basic and simple (i think) pattern. Regardless with or without RichFaces. I hope there is much of competence for JSF here in forum :)

      I have a form with a couple of input fields in it. The value for the field are comming from a bean. The property of the bean have initial values. So when the form first time shown the input fields are initialized. The fields have validators. In the form a have two commands. The one is "OK" and calls some action and another is "reset". The "reset" command must "restore" the initial values (comes from the bean properties) for the input fields. Thats ALL!

      So, the thing is about 10 lines of code. Very simple i thought. After valildation ("OK" command) is failed, the form (view) will be redisplayed and the input fields on the form still have entered before values. Thats ok. But now i want to reset the values in the input fields with "reset" command. And i don't know HOW. The entered values stay sticky in the fields (as local values in the UIInput components, i think) after validation was failed.

      Two solutions comes in to the head for me:
      - direct call setValue() on UIInput component. It is bad, couse i would have to reset each input field manually each time but i need a common solutions, not only for one case.
      - "restart" the view via JSF navigation. Will work may be, but a have to reset only part of the view (modal Panel).

      I hoped that A4J reRender will does it, but it does not. :(

      I think it could be a basic JSF/RichFaces question. Since the pattern is not very uncommon.

      thanks for any advises.

      regards
      Dmitri