3 Replies Latest reply on May 12, 2010 10:05 AM by Bogdan Marian

    s:button vs. onclick

    Markus Dahm Novice

      Hi,


      s:link and s:button behave differently if you add an onclick parameter.


      This is because s:button is rendered with it's own onclick code, which doesn't regard the onclick code. I.e. it is overwritten.
      In my case I'd just like to display some confirm box as in



      s:button action="#{listAdminsForm.deleteAdmin}" onclick="javascript:if(!confirm('Do you really want to delete this entry?')){ return false; } else { return true; }">
      <f:param name="userId" value="#{admin.id}" />
      </s:button>




      This works for fine s:link.


      Is there any workaround or better way to do this?


      Cheers
        Markus.