40 users online (0 members and 40 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 3
  2. submit button enable and disable    Forum: PHP Forum
    Replies: 1
  3. Disable Refresh and Back button??    Forum: HTML Forum
    Replies: 27
  4. Replies: 4
  1. #1
    zzz's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2009
    Posts
    5

    Post enable and disable submit button

    Dear all,

    My requirement goes like this

    1) My requirement is in training a trainee.I have two modules.One is the instructor module and other is the trainee module.

    2) Next instructor(trainer)module is built using php & html
    next my trainee module is built using some other application.

    3)Instructor module have faults to be set in the form of radio buttons.Instructor

    4)Trainee module receives the faults set by instructor

    5)As i send instructor module consists of radio button and submit button, instructor selects a fault (i.e radio button) and then clicks on submit/SET button.On doing this the corresponding value (i.e 1 if SET else 0 if not set) will be written into a text file(say a.txt).

    6)Once the submit/SET button is clicked the button must be disabled.

    7)Now the trainee application will fetch this file and read the corresponding value(i.e the fault).Then this module will give a reply (i.e saying that it has identified the fault) in the form of 0's and 1's written onto a .txt file(say b.txt).

    8)So now my instructor module must read this file.until this the submit/SET button must be disabled.So i should keep on be checking the file

    To do this i used auto refresh say for 1 second, but once refresh the submit/SET button will be reset before trainee identifies the fault.



    waiting for reply at the earliest

  2. #2
    raaj22's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2009
    Posts
    10

    Re: enable and disable submit button

    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