2 Replies Latest reply on Jun 16, 2009 11:05 AM by wang wei

    how to do a check before excute action?

    wang wei Newbie

      I use the rich:extendedDataTable to display the resultList.
      When clicked the <h:commandButton> or <a4j:commandButton> .
      I want do a check,if the selected only one row data,then do action="/edit.xhtml",else display a rich:modalPanel.
      <a4j:commandButton
      action="/edit.xhtml"
      javascript="if(#{tarUserList.selection.size()} != 1) #{rich:component('editPanel')}.show()"
      />

      The problem is the action how to judge the check result?

        • 1. Re: how to do a check before excute action?
          Tim Newbie

           

          "stockInStore" wrote:
          I use the rich:extendedDataTable to display the resultList.
          When clicked the <h:commandButton> or <a4j:commandButton> .
          I want do a check,if the selected only one row data,then do action="/edit.xhtml",else display a rich:modalPanel.
          <a4j:commandButton
          action="/edit.xhtml"
          javascript="if(#{tarUserList.selection.size()} != 1) #{rich:component('editPanel')}.show()"
          />

          The problem is the action how to judge the check result?


          hi,

          you could bind the showWhenRendered attribute of the modalPanel to a bean. calling an actionListener from your button which sets the showWhenRendered of the modalPanel true, if s.th. is wrong and or otherwise to false and return a conditional string for your navigation rule.

          tim