35 users online (2 members and 33 guests)  


  Results 1 to 4 of 4

Related

  1. Replies: 4
  2. Radio Button in PHP    Forum: PHP Forum
    Replies: 3
  3. enable and disable submit button    Forum: PHP Forum
    Replies: 1
  4. submit button enable and disable    Forum: PHP Forum
    Replies: 1
  5. Replies: 1
  1. #1
    zzz's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2009
    Posts
    5

    Post enable and disable the submit button with respect to radio button input

    hi

    i have an application where i need to enable and disable the submit button with radio button input.

    As per my application,we have client server architecture.Here i am using php to design the client application.this consists of 3 radio buttons.Once i select any one radio button and click submit button,the value will be set and sent to the server system.On doing this the submit button must be disabled on the client system until a reply is given by the server system(to do this i will be reading from a file).

    code:
    <form action="" method="post" name="form1">
    <input name="ch1" type="radio" value="a" />
    <input name="ch1" type="radio" value="b" />
    <input name="ch1" type="radio" value="c" />
    <input name="push1" type="submit" value="SET" class="style24" onclick="form1.push1.disabled=true;"/>

    can anyone help in this regard.

  2. #2
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: enable and disable the submit button with respect to radio button input

    PHP Code:
    <?php
    if(isset($_POST['push1']))
        
    $disable true;
    ?>
    <form action="" method="post" name="form1">
    <input name="ch1" type="radio" value="a" />
    <input name="ch1" type="radio" value="b" />
    <input name="ch1" type="radio" value="c" />
    <input name="push1" type="submit" value="SET" class="style24" <?php if($disable) echo 'disabled="disabled';?>/>
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  3. #3
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: enable and disable the submit button with respect to radio button input

    I am not sure what it is your are trying to do with this, zzz. Are you wanting "Please Wait" functionality such as found here when changing pages? Or are you wanting something else?

  4. #4
    raaj22's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2009
    Posts
    10

    Re: enable and disable the submit button with respect to radio button input

    Here is the source in case anyone want to learn:

    <script type="text/javascript">
    function dis_ena_submit()
    {
    if(document.acc_ctrl.add_access.options[0].selected document.acc_ctrl.add_assoc.options[0].selected)
    {
    //Disables submit button
    document.forms[0].grant_button.disabled=true;
    }
    else
    {
    //Enables submit button
    document.forms[0].grant_button.disabled=false;
    }
    }
    </script>

    ...
    <body id="access_control" onload="document.forms[0].grant_button.disabled=true;">
    ...
    <select id="label_add_access" name="add_access" onChange="dis_ena_submit('add_access');">
    ...
    <select id="label_add_assoc" name="add_assoc" onChange="dis_ena_submit('add_assoc');">
    ...
    <input type="submit" value="Grant" name="grant_button" />
    <input type="reset" onclick="document.forms[0].grant_button.disabled=true;"/>



Tags for this Thread