Solved

Submit button greyed out until checkbox checked

Posted on 2011-09-22
2
345 Views
Last Modified: 2012-05-12
How can I use Javascript to make a submit button greyed out until checkbox checked in the form?
0
Comment
Question by:a204801
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36584019
<input id="Submit" type="submit" disabled="disabled" value="Submit" />

<input type="checkbox" id="terms" onclick="if(this.checked) document.getElementById('Submit').removeAttribute('disabled');else document.getElementById('Submit').disabled = 'disabled'">

test page : http://jsfiddle.net/NspG7/
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36584033
another one, just put the following in the head section : http://jsfiddle.net/NspG7/2/
<script language="javascript" type="text/javascript">
window.onload = function() {
    document.getElementById("terms").onchange = function() {
        if(this.checked) {
            document.getElementById('Submit').removeAttribute('disabled');
        }
        else {
            document.getElementById('Submit').disabled = 'disabled';
        }
    }
}
</script>

Open in new window


terms is the ID of your checkbox
Submit is the ID of your submit button
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CRM 2011 how do I change the order currency ? 1 344
JSON nested response not displaying 2 100
form submit not working 9 161
IE 11 javascript function not working 13 205
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question