howto - do JavaScript based navigation in JSF pages

Topic: general|

Question :?:
I have a simple JSF page for user login; it has two <h :inputText> for userName and password.
There is a <h :commandButton> to submit the login request. However, I want to validate the inputs first on the client-side using a JavaScript method (checkInputs) to validate for non-empty inputs, as shown below.

<h :commandButton value=”Login” action=”login”
onclick=”checkInputs(this.form)”/>

the question is howto do JSF actions based on javascript validation?
i want to do the ‘login’ action only if checkInputs returns TRUE, if it returns FALSE
the same page should stay (after an alert() from checkInputs). :???:


 

 


Leave a Reply