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

Capacity planning for service oriented architecture?

soa modeling bpm

I have a collection of SOA components that can handle a series of business processes. For example one SOA component imports user data, another runs analytics on it.

Fail to Import RestKit with Cocoapods Dynamic Frameworks

swift restkit cocoapods

I have the prelease version of cocoapods installed, 0.26, and trying to install the latest version of RestKit. In my podfile I've turned on the use_frameworks! flag to force cocoapods to use dynamic

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.