Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Checkbox activates another field in a GUI???

Results 1 to 10 of 10
Share This Thread →
  1. #1
    MaximusPrime is offline Contributing User
    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    9

    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
    Memnoch's Avatar
    Memnoch is offline Unholy Moderator
    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    658
    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

  3. #3
    MaximusPrime is offline Contributing User
    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    9
    Sorry I did mean enables for input because it is already visible or would you suggest doing it differently?

  4. #4
    Memnoch's Avatar
    Memnoch is offline Unholy Moderator
    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    658
    What I posted should work fine then.

  5. #5
    MaximusPrime is offline Contributing User
    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    9
    Thank you!

  6. #6
    MaximusPrime is offline Contributing User
    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    9
    How do you make this a required field?

  7. #7
    Memnoch's Avatar
    Memnoch is offline Unholy Moderator
    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    658
    You can do it with javascript or you could use a RequiredField Validator control.

  8. #8
    MaximusPrime is offline Contributing User
    Join Date
    Jun 2005
    Location
    Cleveland, OH
    Posts
    80
    Rep Power
    9
    DUH I knew that. Sorry I guess I just had a small brain fart
    Thank you for your help

  9. #9
    markWilson's Avatar
    markWilson is offline Contributing User
    Join Date
    Aug 2008
    Posts
    1,556
    Rep Power
    342
    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

    Andriod KitKat
    Jquery Shake Effect ,

    Thank You,
    KiranK

  10. #10
    foxmaster is offline Registered User
    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.

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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, 01:41 PM
  2. Creating SalesTax Field based on Checkbox
    By bennythejet in forum Microsoft Access Help
    Replies: 4
    Last Post: December 23rd, 2004, 11:00 AM
  3. Replies: 1
    Last Post: December 7th, 2004, 11:50 AM
  4. Can I use checkbox to trigger field input?
    By HDeno in forum Microsoft Access Help
    Replies: 1
    Last Post: October 21st, 2004, 10: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, 05:16 PM

ASP Free Advertisers and Affiliates