1 Reply Latest reply on Oct 15, 2010 5:58 AM by tienlantri

    strange behavior of modalPanel

    tienlantri

      Hello,


      I have a rich:modalPanel launched every time I want to delete something.
      Inside the modalPanel, I have two buttons Yes/No as shown below




      <h:outputLink id="linkSuppression" value="#">
          <h:graphicImage value="/img/icones/supprimer.png" />
          <rich:componentControl for="panelSuppression" attachTo="linkSuppression"   operation="show" event="onclick" />
      </h:outputLink>
      <hardis:modal id="panelSuppression" width="380" height="70" title="Are you sure?">
           <table width="100%">
             <tbody>
                <tr>
                   <td width="50%">
                   <rich:spacer width="20" height="1" styleClass="right"/>
                      <a4j:commandLink ajaxSingle="true" reRender="tablePrestations" eventsQueue="serviceQueue"  action="#{gestionPrestation.deleteSelectedPrestation}" onclick="alert('MMMMMMM')">
                                                                                          <hardis:button id="tablePrestations:#{var}:panelSuppressionBtn1" class="right" title="#{messages['button.yes']}"/>
                     <rich:componentControl for="panelSuppression" attachTo="tablePrestations:#{var}:panelSuppressionBtn1" operation="hide" event="onclick"/>
                                                                                   </a4j:commandLink>
                   </td>
                   <td>
                            here I define No button without action
                         </td>       
                </tr>
             </tbody>
           </table>
      </hardis:modal>




      You can see in commandLink of button Yes, I put


      _onclick="alert('MMMMMMM')"_



      in order to debug if it's in commandLink or not.


      The weird behavior is that if I have alert inside onclick, my action is executed (of course after I click OK on the alert message). Is there any solution to get rid of onclick but my action still executes? If we MUST have onclick to launch action, how do we define a function js on client-side asking to provoke our own action?


      Thanks