web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prepopulating form fie...
Power Apps
Answered

Prepopulating form fields from button press

(0) ShareShare
ReportReport
Posted on by 72

Hi there,

 

I'm having difficulty pre-populating a form field with designated text when I click a button.

 

I want to navigate from my landing page, using a button, to a dedicated form page and at the same time prepopulate the "name" data card value with the "button.text".

 

So far, I've tried:

 

If(
AberdeenButton.Text = "Aberdeen", "ABER1",
EdinburghButton.Text = "Edinburgh", "EDIN1",
GlasgowButton.Text = "Glasgow", "GLAS1"
)

 

As a result, when I press the edinburgh button, "ABER1" still prepopulates the datacard value.

 

Could anybody steer me in the right direction?

 

Thanks in advance.

 

W

  • Verified answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    You can't set property values on controls at runtime since Power Apps is declarative.  What you can do is point the default setting of the control at a variable value.  Then set the context variable value when you navigate to the new screen.  Here are three OnSelect entries for the three buttons.

    Navigate(Screen3,ScreenTransition.Fade,{ButtonText: "Aberdeen"})
    Navigate(Screen3,ScreenTransition.Fade,{ButtonText: "Edinburough"})
    Navigate(Screen3,ScreenTransition.Fade,{ButtonText: "Glasgow"})

    Then the default setting for the text box is ButtonText

  • wilfordm81 Profile Picture
    72 on at

    Thanks @Pstork1 for responding so quickly, and for the solution.

     

    I thought I might've needed to Set a variable onStart or something.

     

    Everyday's a learning day!

     

    👍🏻

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Since you only navigate to the page when pressing a button there is no need to set anything in OnStart.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard