• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript..enabling and disabling a submit button

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i would like to make the submit button on a form to be dissabled by default and when the user checks a checkbox, i want the submit button to be enabled.
pretty urgent...
please help me
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change the submit button to a regular button
<script>
funcion SubIt(){
if(document.formname.checkboxname.checked){
document.formname.submit();
}
}
</script>
in the button use on_click to call the function SubIt();
Any questions just ask
Eric
 
rahul dutt
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai, thanks, but its not what i wanted.
when the form displays i need the button to be disabled by default. and when the user checks the accept terms and conditions checkbox, i want the button to be enabled.
if he unchecks the check box , we have to disable the button again.
thank you
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is what the script will do,,,if the box is checked it will aloow the form to be submitted, if it is unchecked, it will not be able to be submitted, you can make the button change colors or what not depending on if it is checked.
 
reply
    Bookmark Topic Watch Topic
  • New Topic