You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Schröder, Mario <ma...@saxsys.de> on 2007/10/04 16:17:34 UTC

ValueChangeListener again

Hi,

 

I have the following usecase:

 

A user wants to edit some content of an item (let's say a book). He/she changes the values of more the just one properties.

When the users decided that the operation should be cancelled and has something changed, then a warning-dialog should popup. Otherwise nothing should happen and the next page shall be a list of items.

I want to attach a valuechangelistener to each inputfield. When I do it like this:

 

..

 

<tc:in value="#{controller.currentMedia.publisher.name}"

            label="#{bundle.name}" id="publisher_name"

            disabled="#{not controller.editor}" 

            valueChangeListener="#{controller.processEditorChange}">

            <f:facet name="change">

                  <tc:command action="editor" />

            </f:facet>

</tc:in>

 

<tc:in ...

 

The page gets reloaded everytime I switch to another field and the cursor is been set in the first inputfield again, also I get a jsp-error.

 

Has anyone ever implemented such a usecase? How can I do it?

 

This is the part which checks if something has changed:

 

      <tc:button label="#{bundle.cancel}" action="#{controller.cancel}"

            image="images/png/gtk/32x32/button_cancel.png"

            rendered="#{controller.editor}" immediate="true" id="editor_cancel">

            <c:if test="${controller.editorChanged}">

                  <f:facet name="confirmation">

                        <tc:out value="#{bundle.sureQuestion}" />

                  </f:facet>

            </c:if>

      </tc:button>

 

Regards,

Mario