Web Analytics Made Easy -
StatCounter Checkbox with Input Field - CodingForum

Announcement

Collapse
No announcement yet.

Checkbox with Input Field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Checkbox with Input Field

    Hello,

    I need to figure out how to do the following:
    When someone selects a particular checkbox an input field right next to it become editable. Otherwise the input field is readonly.

    Any pointers would be great,!

    - Alex

  • #2
    html code might golike this...

    <input type="checkbox" name="myBox">
    <input type="text" onFocus="checkTheBox()">


    and the js something like this...

    function checkTheBox() {
    if(!document.forms[0].myBox.checked) {
    alert("Unable to edit");
    document.forms[0].myBox.focus();
    }

    This could be modified to enable/disable the text field as well.
    Create accessible online surveys -::- Koobten.com - compare netbook prices and reviews -::- Affordable, reliable hosting for less than $20 per year
    Zend Certified Engineer

    Comment


    • #3
      hmm, I get an object expected error. Does the javascript go in the head section? that's the way I have it.

      - alex

      Comment


      • #4
        <input type="checkbox" name="edit_enable1"
        onclick="t1.readOnly=!this.checked;t1.focus()">
        <input type="text" name="t1" readonly="readonly">
        Last edited by adios; Jun 28, 2002, 02:52 PM.

        Comment


        • #5
          HOw would you make the input line invisible?

          - Alex

          Comment

          Working...
          X