Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Mar 2011
    Thanked 0 Times in 0 Posts

    Question ButtonDisable Function

    Hello CF members,

    i have this problem with my form. atm it has fields where you can write down your info in, a submit button to let it get sended/saved on a location on the server. a reset button and many more.

    but now i have the problem that it goes wrong with 1 of the objects that a person has to select to let the submit button be enabled.

    i have a function that says that several objects/fields must have a value of >0 amount of symbols.

    this worked fine with the textboxes and Select option ( dropdown box ). but now i need a checkbox and thats where the trouble started.

    when i filled in the code to activate the script for the function ( with onclick ) i thoughed i did everything right. but now it see's the value no matter if its unchecked or checked.

    so if i fill in the other required fields/objects the button will become enabled because the checkbox is instantly submitting the value ( towards the function ) anyway.

    which wasn't the case with the textboxes ( onKeyUp ) and the Select ( onclick + onKeyUp ) cause you include symbols yourself with the textboxes ( which activates the >0 ) and the selection of a other option that did had a value.

    the standard selected option doesn't have a value, so thats why it didn't went wrong with the dropdown box. see the function and the textbox+dropdown box that i supported in this post

    i already tested it out that when i remove the value of the checkbox the button stays disabled cause it doesn't get the >0 through.


    now i know the basics of web programming but im not that far that i can spit out a solution for everything thats getting thrown at me and this is 1 of them.

    but i do know that i could use a adjustments that doesn't rely on the value ( so adjustments at ip9 in the function.)
    or that i need a code that sends the value after the checkbox has been checked.

    or something totally different that will make it work :P

    if any1 could support me with this then it would be More then appreciated

    tyvm in advance,

    greetings. me


    - checkbox = ip9
    - the name check2 is used for my (storage/sending) php code.

    PHP Code:

    function ButtonDisable1(ip1,ip2,ip3,ip4,ip5,ip6,ip7,ip8,ip9,but){
     if (

    PHP Code:
    Checkbox that doesn't work__________________________________________

    <input type="checkbox" ID="check5" name="check2" onClick="ButtonDisable1('voor','achter','adres','prov','stad','postcode','telefoon','email','check5','submit_button')" value="Akkoord"<?PHP print $check2?>>
    PHP Code:
    Sample of 1 of the Textboxes that do work_____________________________

    <td class="tdr">&nbsp;<font size="2">Achternaam:</td>
    <td><input type="text" name="achter" value="<?php echo $achter?>" onKeyUp="ButtonDisable1('voor','achter','adres','prov','stad','postcode','telefoon','email','check5','submit_button')"></td>
    PHP Code:
    Dropdown Box that i had and worked__________________________________

    <SELECT ID="check5" name="check2" width="150" onKeyUp="ButtonDisable1('voor','achter','adres','prov','stad','postcode','telefoon','email','check5','submit_button')" onclick="ButtonDisable1('voor','achter','adres','prov','stad','postcode','telefoon','email','check5','submit_button')" >
    <option value="Akkoord" <?PHP print $check2?>> Ja *
    Last edited by jack020; 03-31-2011 at 09:36 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts