2 Replies Latest reply on Jan 4, 2008 7:02 AM by mtaal

    Disable a4j:support client side

    mtaal

      Hi,
      A question, is it possible to disable a4j:support after it has fired once?
      I want to achieve the following. On a form I have a number of fields and a save button, the save button should be enabled when something changed on the form. I also need to keep the changed state server side.
      For this I am considering using the following a4j:support:

      <a4j:support event="onchange" reRender="persistButton"
      action="#{formBean.setDataChanged(true)}"/>
      However I do not want to fire this support event after something changed anymore as this will for sure cost performance. So after the first change the a4j:support should be disabled, is this possible?

      Or should I solve this diffferently?

      Thanks!

      gr. Martin

        • 1. Re: Disable a4j:support client side
          ilya_shaikovsky

          For example you may use onsubmit on support to cancel the request when some flag changed. ;) Hope it helps.

          • 2. Re: Disable a4j:support client side
            mtaal

            Thanks this worked, for reference I did this:

            <a4j:support event="onchange" reRender="updateButton"
             rendered="#{formBean.editMode}"
             oncomplete="dataChanged = true;"
             onsubmit="if (dataChanged) return false;"
             action="#{formBean.setDataChanged(true)}"
             limitToList="true"
             bypassUpdates="true" ajaxSingle="true" />
            


            gr. Martin