7 Replies Latest reply: Jan 4, 2013 4:03 AM by 816482 RSS

    how to disable validations when CommandImageLink is submitted

    swath
      Hi,

      I have some mandatory fields in my page along with CommandButtons and CommandImageLinks.
      I set 'Immediate=true' on button and Imagelink to skip the validations. Button action is working without any issues.
      But, When the ImageLink is cliked I need to perform search on a Table and need to refresh the table. ActionListener is getting triggered but the Table is not refreshing.
      if I remove 'Immediate=true' , table is refreshing but it will fire the validations.

      Any solutions for this?

      Thanks,
      Swathi
        • 1. Re: how to disable validations when CommandImageLink is submitted
          816482
          Hi Swathi,

          You can add partial trigger to the table to trigger refresh from the button.
          Here is useful reference: http://docs.oracle.com/cd/E21764_01/web.1111/b31973/af_ppr.htm

          You can also do it programming at the end of the Action Listener method:

          AdfFacesContext.getCurrentInstance().addPartialTarget(getTableComp());




          Nikolay
          • 2. Re: how to disable validations when CommandImageLink is submitted
            swath
            Thanks Nikolay,

            I tried with partialTriggers and also programmatic refresh .. but the table is not refreshing because of 'Immediate=true'.
            If 'Immediate=false' it is refreshing fine.

            Thanks,
            Swathi
            • 3. Re: how to disable validations when CommandImageLink is submitted
              816482
              Hi Swathi,

              Then you should add partialSubmit="true" to the button as well as immediate="true".
              If this does not work, can you tell me which version of JDev you are using ?


              Nikolay
              • 5. Re: how to disable validations when CommandImageLink is submitted
                swath
                my JDev version is 11.1.1.7.0

                Here is my code : Search Image is inside the Table Header facet. Once it is clicked the table has to be refreshed.
                Included Subform .. but no luck ...
                 <af:table value="#{pageFlowScope.EditGroupBean.al}" var="row"
                                    rowBandingInterval="0" varStatus="vs" id="t2"
                                    rowSelection="multiple"
                                    binding="#{pageFlowScope.EditGroupBean.availableList}"
                                    partialTriggers="s11:cb2"
                                    inlineStyle="height:200.0px;width:261px"
                                    summary="#{backingBeanScope.BundleBean.MEASURES}"
                                    autoHeightRows="#{pageFlowScope.EditGroupBean.availableListSize > 10 ? 10 : -1}"
                                    selectionListener="#{pageFlowScope.EditGroupBean.row}">
                            <af:column id="c4">
                              <af:column id="c6" width="5" minimumWidth="5" rowHeader="true"
                               headerText="#{backingBeanScope.BundleBean.BLANK}">
                              <af:outputText value="#{backingBeanScope.BundleBean.BLANK}"
                                               id="ot5"/>
                              </af:column>
                              <af:column sortProperty="Name" sortable="false" width="258"
                                         headerText="#{backingBeanScope.BundleBean.MEASURE}"
                                         id="c3" rowHeader="unstyled">
                                <af:panelGroupLayout id="pgl6">
                                 <af:outputText value="#{row.label}" id="ot2"/>
                                </af:panelGroupLayout>
                              </af:column>
                              <f:facet name="header">
                                <af:subform id="s11">
                                  <af:panelGroupLayout id="pgl7" layout="horizontal">
                                    <af:inputText label="#{backingBeanScope.BundleBean.SEARCH}"
                                                  id="it3"
                                                  binding="#{pageFlowScope.EditGroupBean.searchField}"
                                                  partialTriggers="cb1" columns="17"/>
                                    <af:spacer width="10" id="s6"/>
                                    <af:commandImageLink id="cb2" partialSubmit="true"
                                                         actionListener="#{pageFlowScope.EditGroupBean.searchAction}"
                                                         icon="#{backingBeanScope.BundleBean.GOIMAGE}"
                                                         />
                                    <af:spacer width="10" id="s7"/>
                                    <af:commandButton text="#{backingBeanScope.BundleBean.CLEAR}"
                                                      id="cb1" immediate="true"
                                                      actionListener="#{pageFlowScope.EditGroupBean.clearSearch}"/>
                                  </af:panelGroupLayout>
                                </af:subform>
                              </f:facet>
                            </af:column>
                          </af:table>
                Thanks,
                Swathi
                • 6. Re: how to disable validations when CommandImageLink is submitted
                  Sireesha Pinninti-Oracle
                  Hi Swathi,

                  PartialSubmit and immediate both don't go well together, when immediate is true on a command button, action gets executed before update model phase so the values you entered in search fields will not be available by the time the action is performed.

                  You can find more info on below link:
                  https://cwiki.apache.org/confluence/display/MYFACES/How+the+immediate+attribute+works (Check UICommand components section)

                  Here is some text copied from above link which tells how to retrieve values in action for this case:
                  For non-immediate input components in the page, the only way an action method for an immediate command component can access user input data is by using component-binding or lookup-by-name to retrieve a specific UIComponent object then calling getSubmittedValue() to obtain the raw string provided by the user. This value has not been converted to its target type (using a user-specified or default Converter), nor has it been validated.

                  Note: There are couple of solutions suggested under Limitations, you may go through and proceed with what fits for you.

                  Sireesha
                  • 7. Re: how to disable validations when CommandImageLink is submitted
                    816482
                    The <af:commandButton> for the clear operation is a child component of <af:table>
                    So in order to refresh the table you should refresh the parent of the <af:table> component.

                    Nikolay