Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to Click a Hidden Button to Clear a Text Field (Without Automate)

(1) ShareShare
ReportReport
Posted on by 81
Hi all. 

I have a form with two data cards. One data card contains a Dropdown and the other contains an Text Input Field.
If the value selected in the Dropdown equals a Key Term, then the data card containing the Text Input Field is visible
so the user can input info. Otherwise, the data card with the Text Input Field is not visible. The code for this is below
and works great. Everything appears and disappears as it should.

Data Card for Text Input Field : Visible Property 
If(
    Or(
        Dropdown.Selected.Value = "Key Term 1",
        Dropdown.Selected.Value = "Key Term 2",
        Dropdown.Selected.Value = "Key Term 3"
    ),
    true,
    false
)
The issue is this: any info the user types into the Text Input Field remains inside it when the user changes their mind,
chooses a non Key Term in the Dropdown and the data card disappears. When the user submits the form, the
unneeded info submits with the form. I want to clear the Text Input Field when the data card itself is not visible. 

I tried doing this using buttons. Button1 resets the Text Input Field. Button2 selects Button1 when the
data card containing the Text Input Field is not visible. The code is below and does not work. Neither button
when the data card disappears.
 
Button1 : OnSelect Property
Reset(TextInputFieldValue)
 
Button2 : OnSelect Property
If(DataCardForTextInput.Visible = false, Select(Button1))
How should this be coded so either:
 
1) A chain reaction occurs (when Text Input Data Card is not visible > Button2 clicks > Button 1 clicks) or 
2) A direct action occurs (when Text Input Data Card is not visible > Button 1 clicks)
 
Please do not answer with Power Automate solutions/flows. The Automate flows I'm already using for this app
takes up to much time to respond and I'd prefer the response time between these buttons to be very very short to
immediate. Any in app solution to clear the text input field when the data card disappears, with or without buttons
is appreciated. Thank you!
  • Verified answer
    Michael E. Gernaey Profile Picture
    40,586 Super User 2025 Season 1 on at
    How to Click a Hidden Button to Clear a Text Field (Without Automate)
    Hi,
     
    Do this
     
    In your Text Inputs Reset property put this
    _ResetText
     
    This is just a variable I am making up
    In the OnVisible Property of the Screen, where the Form is put
     
    Set(_ResetText, true);
    Set(_ResetText, false);
     
    Now in your OnChange of the ComboBox, put the exact same thing at the top.
    Set(_ResetText, true);
    Set(_ResetText, false);
     
    This will force the TextInput to reset immediately as they select something in the combo, whether its Visible or not.
    And now you wont have those unneeded details.
     
     
     
     
  • Suggested answer
    Nandit Profile Picture
    1,563 Super User 2025 Season 1 on at
    How to Click a Hidden Button to Clear a Text Field (Without Automate)
     
    Love the name :D
     
    You can add the following code to the OnChange property of your Dropdown:
    If(
        Or(
            Self.Selected.Value = "Key Term 1",
            Self.Selected.Value = "Key Term 2",
            Self.Selected.Value = "Key Term 3"
        ),
        Set(
            showDataCard,
            true
        ),
        Set(
            showDataCard,
            false
        );
        Reset(TextInputField)
    )
    Here is the Visible property of your TextInputFieldDataCard:
    showDataCard
    Hope this helps. 
     
    Kind regards,
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,552 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard