0 Replies Latest reply on Jan 16, 2009 10:24 PM by hugh.nguyen

    forms not working within datatable (except for the instance

    hugh.nguyen

      Hi there,

      There seem to be a problem with form handling for forms (either a4j:form or h:form) nested within a dataTable (either rich:dataTable or h:dataTable). I've already filed a bug report with JSF for h:form case, but I realised that fixing it in the JSF implementation doesn't fix a4j case, because a4j has its own version of UIForm (UIAjaxForm).

      The situation is like this:
      When a form is nested within a dataTable, although there is one form component in the component tree, it's rendered into multiple instances for each of the table row. A form instance is processed by each of JSF processing phases only if it's marked as having been submitted in the Decodes phase. However, when a form instance other than the one in the last row is submitted, it's submitted flag is cleared in the iterations for later rows in the Decodes phase. Thus when JSF enter subsequent phases, the form processing is skipped, and the form data would not be available in Applications phase.

      I would like to propose a solution: recheck and set the submitted flag at beginning of the later phases. Here is the one line that should go at the beginning of UIAjaxForm.mustProcessed() method:

      setSubmitted(context.getExternalContext().getRequestParameterMap().containsKey(getClientId(context)));


      Hope that this would help anyone who's having the same problem :)