Alpha Video Training
Results 1 to 5 of 5

Thread: Hide / Unhide textbox with a checkbox

  1. #1
    Member
    Real Name
    Steve
    Join Date
    Jun 2017
    Posts
    25

    Default Hide / Unhide textbox with a checkbox

    Hello Alpha Experts,

    I have a UX component with a Textbox and a Checkbox, what I am looking to do is have the Checkbox visible and the Textbox hidden by default
    when the user check the checkbox the Textbox become visible and allow the user to type in a message into the Textbox, if the user uncheck the box
    then the Textbox is cleared and become hidden again.

    Any help on how to implement this will be greatly appreciated

    Thanks.

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,537

    Default Re: Hide / Unhide textbox with a checkbox

    Let's say your Checkbox and Textbox are named chkMsg and txtMessage. The Checkbox type is set to Logical.

    Add a Client-side Show/hide expression to txtMessage...

    Code:
    showHideMessage(chkMsg)
    This is a Javascript function, which you'll put into Javascript Functions...

    Code:
    function showHideMessage(chkMsg){
    
    	if(chkMsg){
    		return true;
    	}else{
    		{dialog.Object}.setValue('txtMessage','',false);
    		return false;
    	}
    
    }
    The show/hide expression calls showHideMessage passing in the value of the chkMsg Checkbox.

    showHideMessage tests chkMsg and returns true is chkMsg is true. This shows txtMessage.
    If chkMsg is false, the function clears txtMessage and then returns false... hiding txtMessage.

  3. #3
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,559

    Default Re: Hide / Unhide textbox with a checkbox

    Quote Originally Posted by hogie503 View Post
    Hello Alpha Experts,

    I have a UX component with a Textbox and a Checkbox, what I am looking to do is have the Checkbox visible and the Textbox hidden by default
    when the user check the checkbox the Textbox become visible and allow the user to type in a message into the Textbox, if the user uncheck the box
    then the Textbox is cleared and become hidden again.

    Any help on how to implement this will be greatly appreciated

    Thanks.
    Here's another simple example ..
    Attached Files Attached Files
    Alpha Anywhere v12.4.5.5.0 Build 5667-5254 IIS v8.5 on Windows Server 2012 in Hyper-V

  4. #4
    Member
    Real Name
    Steve
    Join Date
    Jun 2017
    Posts
    25

    Default Re: Hide / Unhide textbox with a checkbox

    Thank you all, Really appreciate the speedy responses.

  5. #5
    Member
    Real Name
    Steve
    Join Date
    Jun 2017
    Posts
    25

    Default Re: Hide / Unhide textbox with a checkbox

    Quote Originally Posted by iRadiate View Post
    Here's another simple example ..
    Hello,
    Hoping someone can assist me with a change that they now require, this example work great, however they are asking to change things.
    instead of a check box to hide/unhide a Textbox they have a Dropdown with five options, if I select option A then Textbox A is visible,
    Select Option B, Textbox B is visible.. etc... I cant seem to get On change of the Dropdown working with the JavaScript to hide/unhide the individual
    Textbox.. Any help will be greatly appreciated. Thank you

Similar Threads

  1. Mobile - Hide soft keyboard but keep focus in the textbox
    By PaulAmmoun in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 12-20-2016, 10:23 PM
  2. Alternately show and hide Text in a Textbox Password
    By gkpurcey in forum Mobile & Browser Applications
    Replies: 11
    Last Post: 11-10-2016, 01:57 PM
  3. Having a column hide on load, then unhide on click (of a button or another column)
    By pwatt01 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 01-15-2013, 12:08 AM
  4. hide & unhide buttons
    By rrego in forum Alpha Five Version 10 - Desktop Applications
    Replies: 11
    Last Post: 07-12-2011, 11:26 AM
  5. hide/unhide browse columns
    By Marc King - A5solutions in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-03-2004, 12:14 PM

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
  •