ICEfaces
  1. ICEfaces
  2. ICE-5796

Try to eliminate resetHiddenFields() function in Compat Comps.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha3
    • Fix Version/s: 2.0-Beta2, 2.0.0
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      supported browsers
    • Affects:
      Compatibility/Configuration

      Description

      Audit resetHiddenField to find out why we need it, who uses it, etc. Try to eliminate its usage by modifying the components that rely on it.

        Issue Links

          Activity

          Hide
          Ted Goddard added a comment -

          Reset is being applied to javax.faces.encodedURL, which may adversely affect Portal integration.

          Show
          Ted Goddard added a comment - Reset is being applied to javax.faces.encodedURL, which may adversely affect Portal integration.
          Hide
          Ted Goddard added a comment -

          This was analyzed in 2007

          http://jira.icefaces.org/browse/ICE-1391

          The difficulty is that commandLink (and potentially other components) stores a value in a particular hidden field to indicate that the commandLink has been clicked. If the hidden field is not cleared, another click on the commandLink will be registered on the next user event. Clearing the hidden field in an update from the server is not practical as the server may not have the opportunity to reply in time (if the user events are rapid). By default, most components will assume that their hidden fields are cleared, because this would be the typical behavior on a full-page refresh.

          JSF 2.0 commandLink probably behaves differently than the non-Ajax commandLink that this was implemented for. The next step will be to look at how the current commandLink avoids multiple decodes from the same initial event.

          Show
          Ted Goddard added a comment - This was analyzed in 2007 http://jira.icefaces.org/browse/ICE-1391 The difficulty is that commandLink (and potentially other components) stores a value in a particular hidden field to indicate that the commandLink has been clicked. If the hidden field is not cleared, another click on the commandLink will be registered on the next user event. Clearing the hidden field in an update from the server is not practical as the server may not have the opportunity to reply in time (if the user events are rapid). By default, most components will assume that their hidden fields are cleared, because this would be the typical behavior on a full-page refresh. JSF 2.0 commandLink probably behaves differently than the non-Ajax commandLink that this was implemented for. The next step will be to look at how the current commandLink avoids multiple decodes from the same initial event.
          Hide
          Ted Goddard added a comment -

          Testing component-showcase shows no complications from disabling resetHiddenFields().

          Show
          Ted Goddard added a comment - Testing component-showcase shows no complications from disabling resetHiddenFields().
          Hide
          Ted Goddard added a comment -

          <a xmlns="http://www.w3.org/1999/xhtml" href="#" id="iceForm:iceTable:sortByTimeLeft_click" onclick="mojarra.jsfcljs(document.getElementById('iceForm'),

          {'iceForm:iceTable:sortByTimeLeft_click':'iceForm:iceTable:sortByTimeLeft_click'}

          ,'');return false"><span id="iceForm:iceTable:_t21" title="Sort by the Time Left">Time Left</span></a>

          Causes the browser to submit:

          iceForm=iceForm
          ice.window=opgc3w41td
          ice.view=v1ih8s91
          javax.faces.ViewState=-4123099233670977550%3A6666636310014208385
          iceForm%3AiceTable%3AsortByTimeLeft_click=iceForm%3AiceTable%3AsortByTimeLeft_click
          javax.faces.source=iceForm
          javax.faces.partial.execute=%40all
          javax.faces.partial.render=%40all
          ice.window=opgc3w41td
          ice.view=v1ih8s91
          ice.event.target=iceForm%3AiceTable%3A_t21
          ice.event.captured=iceForm
          ice.event.type=onclick
          ice.event.alt=false
          ice.event.ctrl=false
          ice.event.shift=false
          ice.event.meta=false
          ice.event.x=666
          ice.event.y=171
          ice.event.left=false
          ice.event.right=false
          ice.submit.type=ice.s
          ice.submit.serialization=form
          javax.faces.partial.ajax=true

          Show
          Ted Goddard added a comment - <a xmlns="http://www.w3.org/1999/xhtml" href="#" id="iceForm:iceTable:sortByTimeLeft_click" onclick="mojarra.jsfcljs(document.getElementById('iceForm'), {'iceForm:iceTable:sortByTimeLeft_click':'iceForm:iceTable:sortByTimeLeft_click'} ,'');return false"><span id="iceForm:iceTable:_t21" title="Sort by the Time Left">Time Left</span></a> Causes the browser to submit: iceForm=iceForm ice.window=opgc3w41td ice.view=v1ih8s91 javax.faces.ViewState=-4123099233670977550%3A6666636310014208385 iceForm%3AiceTable%3AsortByTimeLeft_click=iceForm%3AiceTable%3AsortByTimeLeft_click javax.faces.source=iceForm javax.faces.partial.execute=%40all javax.faces.partial.render=%40all ice.window=opgc3w41td ice.view=v1ih8s91 ice.event.target=iceForm%3AiceTable%3A_t21 ice.event.captured=iceForm ice.event.type=onclick ice.event.alt=false ice.event.ctrl=false ice.event.shift=false ice.event.meta=false ice.event.x=666 ice.event.y=171 ice.event.left=false ice.event.right=false ice.submit.type=ice.s ice.submit.serialization=form javax.faces.partial.ajax=true
          Hide
          Ted Goddard added a comment -

          mojarra cleans up such hidden fields directly via mojarra.apf (add) and mojarra.dpf (delete).

          /*

          • This is called by command link and command button. It provides
          • the form it is nested in, the parameters that need to be
          • added and finally, the target of the action. This function
          • will delete any parameters added <em>after</em> the form
          • has been submitted to handle DOM caching issues.
            *
          • @param f - the target form
          • @param pvp - associative array of parameter
          • key/value pairs to be added to the form as hidden input
          • fields.
          • @param t - the target of the form submission
            */
            mojarra.jsfcljs = function jsfcljs(f, pvp, t) {
            mojarra.apf(f, pvp);
            var ft = f.target;
            if (t) { f.target = t; }

            f.submit();
            f.target = ft;
            mojarra.dpf(f);
            };

          /*

          • This function adds any parameters specified by the
          • parameter 'pvp' to the form represented by param 'f'.
          • Any parameters added will be stored in a variable
          • called 'adp' and stored on the form.
            *
          • @param f - the target form
          • @param pvp - associative array of parameter
          • key/value pairs to be added to the form as hidden input
          • fields.
            */
            mojarra.apf = function apf(f, pvp) {

          /**

          • This function deletes any hidden parameters added
          • to the form by checking for a variable called 'adp'
          • defined on the form. If present, this variable will
          • contain all the params added by 'apf'.
            *
          • @param f - the target form
            */
            mojarra.dpf = function dpf(f) {
          Show
          Ted Goddard added a comment - mojarra cleans up such hidden fields directly via mojarra.apf (add) and mojarra.dpf (delete). /* This is called by command link and command button. It provides the form it is nested in, the parameters that need to be added and finally, the target of the action. This function will delete any parameters added <em>after</em> the form has been submitted to handle DOM caching issues. * @param f - the target form @param pvp - associative array of parameter key/value pairs to be added to the form as hidden input fields. @param t - the target of the form submission */ mojarra.jsfcljs = function jsfcljs(f, pvp, t) { mojarra.apf(f, pvp); var ft = f.target; if (t) { f.target = t; } f.submit(); f.target = ft; mojarra.dpf(f); }; /* This function adds any parameters specified by the parameter 'pvp' to the form represented by param 'f'. Any parameters added will be stored in a variable called 'adp' and stored on the form. * @param f - the target form @param pvp - associative array of parameter key/value pairs to be added to the form as hidden input fields. */ mojarra.apf = function apf(f, pvp) { /** This function deletes any hidden parameters added to the form by checking for a variable called 'adp' defined on the form. If present, this variable will contain all the params added by 'apf'. * @param f - the target form */ mojarra.dpf = function dpf(f) {
          Hide
          Ted Goddard added a comment -

          In other words, JSF 2.0 indicates that component developers should deal explicitly with hidden fields. We can therefore remove this function from ICEfaces compat and require that the necessary component fixes be applied.

          Show
          Ted Goddard added a comment - In other words, JSF 2.0 indicates that component developers should deal explicitly with hidden fields. We can therefore remove this function from ICEfaces compat and require that the necessary component fixes be applied.
          Hide
          Ted Goddard added a comment -

          MyFaces 2.0 makes use of a form-marker field (without an ID):

          <input name="iceform_SUBMIT" type="hidden" value="1" />

          When this field is cleared, MyFaces assumes that the form has not been submitted. It is very unlikely that a heuristic can be found for this function. Instead, it should be removed.

          Show
          Ted Goddard added a comment - MyFaces 2.0 makes use of a form-marker field (without an ID): <input name="iceform_SUBMIT" type="hidden" value="1" /> When this field is cleared, MyFaces assumes that the form has not been submitted. It is very unlikely that a heuristic can be found for this function. Instead, it should be removed.
          Hide
          Ted Goddard added a comment -

          Assigning to Mandeep to determine if there are any regressions introduced by this change.

          Show
          Ted Goddard added a comment - Assigning to Mandeep to determine if there are any regressions introduced by this change.
          Hide
          Mandeep Hayher added a comment -

          Icefaces2 branch revision# 22186
          Server: Tomcat6
          Browsers: FF3.6, IE7 & Opera10.10

          These results are in comparison to the Icefaces2 trunk regression test results.

          Fixed Issues:
          ICE-2283 IE this fails on icefaces2 trunk

          New Failures: None

          Show
          Mandeep Hayher added a comment - Icefaces2 branch revision# 22186 Server: Tomcat6 Browsers: FF3.6, IE7 & Opera10.10 These results are in comparison to the Icefaces2 trunk regression test results. Fixed Issues: ICE-2283 IE this fails on icefaces2 trunk New Failures: None

            People

            • Assignee:
              Unassigned
              Reporter:
              Mircea Toma
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: