Trying to enable a disabled button when a textfield is not empty

So im just trying to enable a button when 3 text fields are not empty,and disable the button again if they become empty.Right now I was only trying it with one field just to get it working first but cant get it to work and no idea why.Would appreciate any help

     <head>
        <script type="text/javascript">
        function checkEnableSubmit() {
           if ( completePurchaseForm.address.value != "") 
          {document.getElementById("button").disabled = false;}
      }
       </script>




        <form action="RegServlet" name="completePurchaseForm" method="post">
            <table>
                <tr>
                    <td> Address  : </td><td> <input name="address" onkeyup="checkEnableSubmit()" id="address" size=100 type="text" /> </td> 
                </tr>
                                    <tr>
                    <td> Card Type  : </td><td> <input name="cardType" id="cardType" size=15 type="text" /> </td> 
                </tr>
                <tr>
                    <td> Card Number  : </td><td> <input name="cardNumber" id="cardNumber" size=15 type="text" /> </td> 
                </tr>
            </table>

            <input type="hidden" name="action" value="completePurchase" />
            <input type="button" disabled name="submit" value="Complete your purchase" />
        </form>

Answers


Add id to your button <input type="button" id="button1"> to use document.getElementById("button1")


Need Your Help

Running p2.process.artifacts in Jenkins

eclipse ant equinox eclipse-pde p2

I read the SO post Running P2 Ant tasks outside Eclipse, which was a great help. I am trying to call p2.process.artifacts, however I am not sure what arguments should I pass to java task call. What

ActiveMQ with Apache Karaf 2.3.1

java osgi activemq apache-karaf osgi-bundle

I have ActiveMQ 5.8.0 and Karaf 2.3.1 running separately.