IDEA doesn't do anything on JavaScript "onclick"

I have a simple JSF project (from the Core JavaServer Faces, 3rd Edition, Ch 4.), but the onclick doesn't appear to be executing the actual JavaScript file.

IDEA (14.1.4) seems happy with all the paths (such as <h:outputScript library="javascript" name="checkPassword.js"/>), and the project overall as far as I can see.

Also, I can hardcode an "alert()" into the onclick in the index.xhtml and that works.

This may not be an IDEA issue, but I'm confused why the JavaScript call isn't working.

Here's the JS file:

function checkPassword(form)
    alert("inside js");
    var password = form[ + ":password"].value;
    var passwordConfirm = form[ + ":passwordConfirm"].value;

    if(password == passwordConfirm)
        alert("Password and password confirm fields don't match");

Here's the index.xhtml file that calls it:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=""

    <h:outputStylesheet library="css" name="styles.css"/>
    <h:outputScript library="javascript" name="checkPassword.js"/>


        <h:panelGrid columns="2" columnClasses="evenColumns, oddColumns">


            <h:inputSecret id="password"/>

            <h:inputSecret id="passwordConfirm"/>


        <!--Execute JavaScript function on click of the button-->
        <h:commandButton type="button" value="Submit Form" onclick="checkPassword(this.form)"/>



Intellij is fine with the entire configuration. If I rename anything, it goes red right away. Yet, when I click the "Submit" button, absolutely nothing happens.

The project structure is shown on the attachment.

Any suggestions greatly appreciated.


- m


Please sign in to leave a comment.