ICEfaces
  1. ICEfaces
  2. ICE-8910

ace:autoCompleteEntry - Add functionality to prevent the component from submitting on option select

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2, EE-3.2.0.BETA
    • Fix Version/s: 3.3
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All
    • Salesforce Case Reference:
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.)

      Description

      The current behavior of the ice:selectInputText and ace:autoCompleteEntry components is to submit the form when an option has been selected by the mouse.

      The feature request is to add a way to prevent this from happening so that only the valueChangeListener is called and not the forms action/actionListener methods. With this functionality the forms methods would only be called when the enter key is pressed in the input fields.
      1. Case11915Example.zip
        18 kB
        Arran Mccullough
      2. Case11915ExampleWAR.zip
        9.32 MB
        Arran Mccullough

        Issue Links

          Activity

          Hide
          Arran Mccullough added a comment -

          Attached test case that demonstrates the current behavior for each component.

          Entering in some text into a component then selecting the value with the mouse causes the forms action method to be called.

          Show
          Arran Mccullough added a comment - Attached test case that demonstrates the current behavior for each component. Entering in some text into a component then selecting the value with the mouse causes the forms action method to be called.
          Hide
          Arturo Zambrano added a comment -

          I ran the test app, and then I tried it with the latest revision of all the jars (icefaces.jar, icefaces-ace.jar, icefaces-compat.jar, icepush.jar). The form actionListener is never fired with the latest revision when interacting with ace:autoCompleteEntry in any way, not even when you press enter. There were some relatively recent changes in ace:autoCompleteEntry, among them is preventing the form from sending a request when pressing enter on this component, since the component already sends its own request. Would this new behaviour satisfy the customer's requirements?

          The ice:selectinputText component continues to work in the same way. Does the customer needs the described behaviour in both components? or, as long as one of them works as they want is enough?

          Show
          Arturo Zambrano added a comment - I ran the test app, and then I tried it with the latest revision of all the jars (icefaces.jar, icefaces-ace.jar, icefaces-compat.jar, icepush.jar). The form actionListener is never fired with the latest revision when interacting with ace:autoCompleteEntry in any way, not even when you press enter. There were some relatively recent changes in ace:autoCompleteEntry, among them is preventing the form from sending a request when pressing enter on this component, since the component already sends its own request. Would this new behaviour satisfy the customer's requirements? The ice:selectinputText component continues to work in the same way. Does the customer needs the described behaviour in both components? or, as long as one of them works as they want is enough?
          Hide
          Arturo Zambrano added a comment - - edited

          You can add these tags inside ace:autoCompleteEntry and it will prevent the form actionListener from being fired when typing a character and when selectiing an item or pressing enter.

          <ace:ajax event="textChange" execute="@this" />
          <ace:ajax event="valueChange" execute="@this" />
          

          It is not possible at the moment to send a request to execute the entire form (and thus fire the form actionListener) when pressing enter, unless you use execute="@form". In other words, it is not possible to distinguish between pressing enter or clicking on an item because internally, that's the same event, a valueChange event, which was recently added to distingish from a simple textChange event (i.e. adding/removing characters from the field).

          So, I can only think of two ways to solve this: A) we add a new attribute to submit the whole form when pressing enter, or B) modify our ajax framework to pass the ajax request settings object to the onStart callback, in order to allow modifying them as the user wishes, before sending the request. I'll discuss this with the team to see what's more convenient.

          Show
          Arturo Zambrano added a comment - - edited You can add these tags inside ace:autoCompleteEntry and it will prevent the form actionListener from being fired when typing a character and when selectiing an item or pressing enter. <ace:ajax event= "textChange" execute= "@ this " /> <ace:ajax event= "valueChange" execute= "@ this " /> It is not possible at the moment to send a request to execute the entire form (and thus fire the form actionListener) when pressing enter, unless you use execute="@form". In other words, it is not possible to distinguish between pressing enter or clicking on an item because internally, that's the same event, a valueChange event, which was recently added to distingish from a simple textChange event (i.e. adding/removing characters from the field). So, I can only think of two ways to solve this: A) we add a new attribute to submit the whole form when pressing enter, or B) modify our ajax framework to pass the ajax request settings object to the onStart callback, in order to allow modifying them as the user wishes, before sending the request. I'll discuss this with the team to see what's more convenient.
          Hide
          Arturo Zambrano added a comment - - edited

          Committed fix to trunk at revision 33813.

          After the improvements made in ICE-8993, the 'cfg' object is added a 'trigger' property which can be checked in ace:ajax's onStart to determine whether the submit was triggered by an enter key press on the text field. If the value of this property is 'textFieldEnter', the submit was initiated by an enter key press on the text field, so the 'execute' and 'render' values can be modified from the onStart function.

          The technique would look something like this:

          <ace:ajax event="textChange" execute="@this" render="@this" />
          <ace:ajax event="valueChange" execute="@this" render="@this" onStart="if (cfg.trigger) if (cfg.trigger == 'enter')

          { cfg.execute = '@form'; cfg.render = '@form';}

          return true;" />

          Show
          Arturo Zambrano added a comment - - edited Committed fix to trunk at revision 33813. After the improvements made in ICE-8993 , the 'cfg' object is added a 'trigger' property which can be checked in ace:ajax's onStart to determine whether the submit was triggered by an enter key press on the text field. If the value of this property is 'textFieldEnter', the submit was initiated by an enter key press on the text field, so the 'execute' and 'render' values can be modified from the onStart function. The technique would look something like this: <ace:ajax event="textChange" execute="@this" render="@this" /> <ace:ajax event="valueChange" execute="@this" render="@this" onStart="if (cfg.trigger) if (cfg.trigger == 'enter') { cfg.execute = '@form'; cfg.render = '@form';} return true;" />
          Hide
          Arturo Zambrano added a comment - - edited

          Committed final fix to trunk at revision 33995.

          The ace:autoCompleteEntry component was slightly modified to render the script tag that renders the list of options inside the root node, so that it gets sent to the client when using render="@this" in ace:ajax.

          The scenario desired by the customer is now possible by adding the ajax tags posted above to the ace:autoCompleteEntry component.

          Show
          Arturo Zambrano added a comment - - edited Committed final fix to trunk at revision 33995. The ace:autoCompleteEntry component was slightly modified to render the script tag that renders the list of options inside the root node, so that it gets sent to the client when using render="@this" in ace:ajax. The scenario desired by the customer is now possible by adding the ajax tags posted above to the ace:autoCompleteEntry component.
          Hide
          Ken Fyten added a comment -

          Let's add this scenario to the Wiki page for the component.

          Show
          Ken Fyten added a comment - Let's add this scenario to the Wiki page for the component.

            People

            • Assignee:
              Arturo Zambrano
              Reporter:
              Arran Mccullough
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: