1 Reply Latest reply on Feb 12, 2009 10:29 AM by Wolfgang Knauf

    Calling Java script In JSF

    Debasree Saha Newbie

      Hi,

      Please advice me on how to call java script functions in JSF. My requirement is to call a validation function on clicking the "save" button to check if the all inputs are valid or not. I have written one java script within the jsf(xhtml) page and calling this method as

      <h:commandButton value="Confirm" action="#{check}"/>


      here check is the function. This function is as below:

      <jbpm:dataform>
      <h:form>
      //<![CDATA[
      function check()
      {
      alert("my function");
      }
      //]]>

      </h:form>
      .......
      </jbpm:dataform>

      Please tell where I am wrong. Why this function is not called.

      Thanks in advance.

        • 1. Re: Calling Java script In JSF
          Wolfgang Knauf Master

          Hi,

          same as for your other post: as this does not seem to be a JSFUnit question, please post it in JSF forums.

          The "commandButton" has a "onClick" attribut. From the doc:

          onclick: In the attribute, a JavaScript method is specified that is called when the component is clicked by user.


          Hope this helps

          Wolfgang