SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Greyed out box on form not resetting properly

    I have a form with a text box that is greyed out unless a checkbox is checked. The problem is if the checkbox is checked and this enables the text box to enter data and I hit reset, the text box does not reset and turn grey. It allows data to be entered. I have both the html reset button and the javascript clear form, but neither seem to work. How do I reset the text box to grey as well if reset is hit?

    Code:
      <form method="post" action="" name="resetproblemform" enctype="text/plain" onReset="return confirm('Do you really want 
    
    to reset the form?')">
         <div>Check Which Apply: &nbsp;&nbsp;&nbsp; 
            LineTest1<input type="checkbox" name="status" value="1" style="margin-left:10px; margin-right:40px" 
    
    onclick="this.form.line1test2.disabled = !this.checked;"/> 
               Line1Test2<input type="text" name="line1test2" style="margin-left:10px; margin-right:67px" maxlength="9" 
    
    disabled="disabled" size="9"/> </div>
         <div class="break10" style="margin-left:140px"> 
           Line2Test1<input type="checkbox" name="status" value="3" style="margin-left:10px; margin-right:40px" 
    
    onclick="this.form.line2test2.disabled = !this.checked;"/>  
            Line2Test2<input type="text" name="line2test2" style="margin-left:10px; margin-right:67px" maxlength="9" 
    
    disabled="disabled" size="9"/> </div>
         <div class="break10" style="margin-left:140px">Line3Test1<input type="checkbox" name="status" value="5" 
    
    style="margin-left:10px"/> </div>
    
          <input type="submit" value="Submit" />
         <input type="button" value="Reset JAVA" onClick="this.form.reset()" />
          <input type="reset" value="Rest HTML" />
        </form>

  2. #2
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone have any guidance on this? Is this a difficult problem no one knows how to figure out? If it's easy please direct me to where I can figure it out. Thx.


Bookmarks

Posting Permissions

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