6 Replies Latest reply on Sep 22, 2010 1:02 AM by chakri_jboss

    rich:inplaceInput onsave and oncancel events

    ricardocampos

      It would be useful to have "onsave" and "oncancel" events in rich:inplaceInput :-)

        • 1. Re: rich:inplaceInput onsave and oncancel events
          ilya_shaikovsky

          these events already present.

          This events fired before switching and allow to cancel switching.

          onviewactivation
          oneditactivation

          and this events fired after in order to send request for example.

          onviewactivated
          oneditactivated

          • 2. Re: rich:inplaceInput onsave and oncancel events
            ricardocampos

            Hello!

            Thank you for the reply, but I think I will have to show what I want to do.

            This is the deal: I want to fire an ajax action if, and only if, the user hits the save button (which is displayed with showControls)... So here is what I've done:

            <rich:inplaceInput value="#{bean.property}" showControls="true">
             <a4j:support action="#{beanAction.save}" ajaxSingle="true" event="onviewactivated" />
            </rich:inplaceInput>
            


            It works pretty well, except it fires the action wheter the user hits save (the V button) or cancel (the X button)... If there was a "onsave" event, I could use like this:

            <rich:inplaceInput value="#{bean.property}" showControls="true">
             <a4j:support action="#{beanAction.save}" ajaxSingle="true" event="onsave" />
            </rich:inplaceInput>
            


            That way, the ajax action is only fired if the user hits the save button within the edit mode... All existing events, including "onchange", don't work as I wish...

            Thanx!!!

            • 3. Re: rich:inplaceInput onsave and oncancel events
              ilya_shaikovsky

              how about store old value and check if it was changesd in onsubmit of a4j:support? seems not a complex task...

              • 4. Re: rich:inplaceInput onsave and oncancel events
                ilya_shaikovsky

                and even easier

                <a4jupport event="onviewactivated" onsubmit="if (event.memo.oldvalue!=event.memo.nevalue) return false;"></a4jupport>


                • 5. Re: rich:inplaceInput onsave and oncancel events
                  ricardocampos

                  That way didn't work well, but I got the idea and I could make it work like this:

                  <rich:inplaceInput value="#{bean...}" showControls="true" onviewactivation="old = event.memo.oldValue;">
                   <a4j:support action="#{action...}" ajaxSingle="true" event="onviewactivated" onsubmit="if (event.memo.value == old) return false;" />
                  </rich:inplaceInput>
                  


                  It worked fine that way... Thanx for the help!

                  P.S: But I still think the onsave / oncancel events is a good idea! Makes things easier and has other utilities too... :-)

                  • 6. Re: rich:inplaceInput onsave and oncancel events
                    chakri_jboss

                    what are the events that inplaceInput raises , so that a4j:support can fire a reqeust, i tried with "onviewactivated" but seems not to be working. moreover i need to handle this ajax event in spring Webflow. so pls provide me any relevant suggestions on this. thankyou.