#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    10

    Checkbox activates another field in a GUI???


    My question is probably pretty simple for you guys (and gals)

    Anyhow I am in a dreamweaver environment using asp.net and vb.net. I have built a GUI that hase several different areas for a user to input information on of the fields is a checkbox. I would like it when the user checks the checkbox it activates another field which is a textbox and requires the user to input initials to be able to submit the form. How would I go about doing this? Thanks in advance
  2. #2
  3. Unholy Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    659
    what do you mean by activates? makes it visible or just makes it enabled to accept user input?

    Example:
    Making it enabled
    Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
       If Page.IsPostBack Then
          TextBox1.Enabled = CheckBox1.Checked
       End If
    End Sub
  4. #3
  5. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    10
    Sorry I did mean enables for input because it is already visible or would you suggest doing it differently?
  6. #4
  7. Unholy Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    659
    What I posted should work fine then.

    Comments on this post

    • MaximusPrime agrees
  8. #5
  9. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    10
    Thank you!
  10. #6
  11. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    10
    How do you make this a required field?
  12. #7
  13. Unholy Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    659
    You can do it with javascript or you could use a RequiredField Validator control.
  14. #8
  15. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    10
    DUH I knew that. Sorry I guess I just had a small brain fart
    Thank you for your help
  16. #9
  17. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Aug 2008
    Location
    USA
    Posts
    1,590
    Rep Power
    343
    Hi,

    to validate you need to put wither javascript like
    Code:
    if( document.getElementByid('txtbox').value=="")
    {
     alert('Value Required');
    }
    or directly place aspx requiredfieldvalidator control like this way.
    Code:
    Name: <asp:TextBox id="name" runat="server" />
    <asp:Button runat="server" Text="Submit" />
    <asp:RequiredFieldValidator ControlToValidate="name" Text="The name field is required!" runat="server" />
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

    Jquery Shake Effect ,
    Andriod KitKat


    Thank You,
    KiranK
  18. #10
  19. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0
    All of this explains how to make a field active and require an entry. But, first you have to make sure that the Checkbox caused the postback.

Similar Threads

  1. Input current date into a field by clicking checkbox
    By babyewok in forum Microsoft Access Help
    Replies: 7
    Last Post: April 8th, 2007, 02:41 PM
  2. Creating SalesTax Field based on Checkbox
    By bennythejet in forum Microsoft Access Help
    Replies: 4
    Last Post: December 23rd, 2004, 12:00 PM
  3. Replies: 1
    Last Post: December 7th, 2004, 12:50 PM
  4. Can I use checkbox to trigger field input?
    By HDeno in forum Microsoft Access Help
    Replies: 1
    Last Post: October 21st, 2004, 11:03 AM
  5. Simple combo box/text box issue, difficult description (part 1)
    By etalent in forum Microsoft Access Help
    Replies: 1
    Last Post: March 29th, 2004, 06:16 PM

IMN logo majestic logo threadwatch logo seochat tools logo