Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default disable/enable

    I have a form to included these file
    1. Radio buttons. button1, button2
    2. Some text boxes: fname, lname, address, phone, etc.
    3. Some submit buttons
    When user click on radio button1, all the textboxes were enable, and when user
    click on radio button 2, all the text box were disable. I made it working,
    however, when user click on radio button1 and fill out the information then
    click on submit button then all the text box were disable because these text
    fields were depend on the disable/enable function. How do keep these text box
    enable when I click on the submit button?


    kt03 Guest

  2. Similar Questions and Discussions

    1. Enable Disable fields onclick
      I have a cfinput field that is disabled when the form first loads (disabled="true") I want to click a button to enable the field. ...
    2. Validators Enable & Disable Issue
      Hi Guys , I have used few validators on few fields in my form, i have a reset button which reset the current contents of those fields. When i do...
    3. enable/disable
      How can do disable and enable for radio box? it worked for all my text box but not for radio box ======= <script language="JavaScript"> function...
    4. NEED HELP W/ ENABLE/DISABLE CHECKBOXES AND TEXTBOXES
      Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another...
    5. Wanted:PL/SQL to Disable & Enable Constraints
      I need one or two PL/SQL's that will let me - Disable ALL Constraints for one or more tables and at a later time - Enable ALL Constraints...
  3. #2

    Default Re: disable/enable

    Hi

    r u calling the radio button function on the submit button.?

    vkunirs Guest

  4. #3

    Default Re: disable/enable

    No, I have the disable/enable funciton and used Onclick to calling these fc for radio button. I didn't calling any fc for submit buton. what should I do?
    kt03 Guest

  5. #4

    Default Re: disable/enable

    you'd be better off either using layer hiding via styles and javascript, or <cfparam> on your action page for those fields.
    gwgiswebmaster Guest

  6. #5

    Default Re: disable/enable

    What did you mean, would you be more specific?

    Thanks
    kt03 Guest

  7. #6

    Default disable/enable

    This code is woked if both text box name diffrentlly, but insn't worked when I
    have the same name.
    What should I do to make it work if I have the same name for both text box?

    <input type="text" class="thDarkL" size="30" name="email_address" disabled>
    <input type="text" class="thDarkL" size="30" name="email_address" disabled>

    <input type="radio" class="tdbg" name="fc" value="5" onclick
    ="EnableNewEmail();">
    <input type="radio" class="tdbg" name="fc" value="5" onclick
    ="DisableNewEmail();">

    <script type="text/javascript">
    function DisableNewEmail()
    { document.frm.email_address.disabled=true; }

    function EnableNewEmail()
    {document.frm.email_address.disabled=false; }
    </script>

    kt03 Guest

  8. #7

    Default Re: disable/enable

    why are they named the same? How can they be unique if they have the same name.

    If you need multiple values to be selectable, then use a multi select list.

    -westside
    WestSide Guest

  9. #8

    Default Re: disable/enable

    Two form fields have to have 2 different names... If they are both
    "email_address" you will have no way to validate that they are the same...

    Just name them:

    email_address1
    email_address2

    then modify your functions to

    function DisableNewEmail()
    { document.frm.email_address1.disabled=true;
    document.frm.email_address2.disabled=true }

    function EnableNewEmail()
    {document.frm.email_address1.disabled=false;
    document.frm.email_address2.disabled=false }

    jeby Guest

  10. #9

    Default disable/enable

    Hi,

    I have one check box and one textbox. First time, when user opens the page,
    the textbox is disabled. If user check the checkbox, then textbox is enabled,
    else, user un-check the checkbox then textbox is disabled. My code is work
    only one way to make the textbox enabled but can?t make the textbox disable
    again.

    Please see the attached code below
    ==========================

    function EnableKey(){
    document.frm.key_expiry.disabled=false;
    }

    function DisableKey(){
    document.frm.key_expiry.disabled=true;
    }

    Form. cfm
    =====================
    <input type="checkbox" name="col" value="1" onClick='EnableKey();'>Temp
    Key Expiry<input id="demo1"type="text" name="key_expiry" disabled value="">

    newcf Guest

  11. #10

    Default Re: disable/enable

    function toggleEnabled(){
    if(document.frm.key_expiry.disabled) {
    document.frm.key_expiry.enabled = true;
    } else {
    document.frm.key_expiry.disabled=false;
    }
    }

    Form.cfm
    =====================
    <input type="checkbox" name="col" value="1" onClick='toggleEnabled();'>Temp
    Key Expiry<input id="demo1"type="text" name="key_expiry" disabled value="">

    Kronin555 Guest

  12. #11

    Default Re: disable/enable

    .... or you could also use ...

    <script type="text/javascript">
    function toggleEnabled(){
    document.frm.key_expiry.disabled = !document.frm.key_expiry.disabled;
    }
    </script>
    ....
    <input type="checkbox" name="col" value="1" onClick='toggleEnabled();'>Temp
    ....

    mxstu Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139