real_illusions Posted March 1, 2006 Share Posted March 1, 2006 i need a multi-browser way of disabling the submit button on a form untill the user ticks a box.you can see the form here - http://www.midlandkarting.co.uk/onlinebooking.phpif you can work out whats what in the source code (you should be able to)but, it only works in firefox, and not in explorer.in explorer, you check the box, but when you press the submit button, it disables and nothing happens. Link to comment Share on other sites More sharing options...
Err Posted March 1, 2006 Share Posted March 1, 2006 edit: Whoops, just reread your post... I'm sure you can do that through javascript somehow, I know how you can disable the form when it's pressed though. <script type="text/javascript">function nextbutton(param) { param = document.getElementById(param); param.disabled = true; param.value="Next...";}</script> <form name="input" action="page2.html" onsubmit="nextbutton('next');"><input type="submit" value="Next »" id="next" /></form> You can change what you need too. Link to comment Share on other sites More sharing options...
pulpfiction Posted March 1, 2006 Share Posted March 1, 2006 Javascriptfunction disable(s) { if (s.checked == true) document.getElementById("sub").disabled=false }HTML<input type=radio name="r" onclick="disable®"><input type=button value="submit" id="sub" disabled=true> Link to comment Share on other sites More sharing options...
real_illusions Posted March 2, 2006 Author Share Posted March 2, 2006 Javascriptfunction disable(s) { if (s.checked == true) document.getElementById("sub").disabled=false }HTML<input type=radio name="r" onclick="disable®"><input type=button value="submit" id="sub" disabled=true><{POST_SNAPBACK}> doesn't work at all now Link to comment Share on other sites More sharing options...
sbrownii Posted March 2, 2006 Share Posted March 2, 2006 instead of : <input type=radio name="r" onclick="disable®"> try: <input type=radio name="r" onclick="disable()"> Why are you calling the function disable() if it is actually there to enable? it's just confusing...As far as what you are trying to do, and what the original problem was.... I don't understand.You want the user to only be able to click the submit button after they have clicked a radio button?The problem is that your previous method of enabling the submit button was only working in FF? Or is it that the form wouldn't submit? Link to comment Share on other sites More sharing options...
real_illusions Posted March 2, 2006 Author Share Posted March 2, 2006 instead of :<input type=radio name="r" onclick="disable®"> The problem is that your previous method of enabling the submit button was only working in FF? Or is it that the form wouldn't submit? <{POST_SNAPBACK}> the original problem was that it only worked in firefox. in explorer, the button enbale/disable thing worked, but when you pressed submit, it just disabled and nothing was sent.i need the submit button disabled, untill the user checks a box or radio button. then when they do, they can submit the form. Link to comment Share on other sites More sharing options...
scott100 Posted March 2, 2006 Share Posted March 2, 2006 Hi real_illusions, this does what you want: <head><script>function check(){tick=document.getElementById("agree").checked;if (tick==true)document.getElementById("sub").disabled=false;else document.getElementById("sub").disabled=true;}</script></head><body><form name="input" action="html_form_action.asp" method="post">Do you agree? <input type="checkbox" id="agree" onclick="check()" /><br /><br /><input type="submit" value="submit" id="sub" disabled="true"></form></body> Link to comment Share on other sites More sharing options...
real_illusions Posted March 2, 2006 Author Share Posted March 2, 2006 thanks scott!just what i need:) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now