cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ErikLa
Regular Visitor

Create a Toggle to prefix text to a Text Input field

I am creating an App that will create Sites based on the information input into the App. The first Input Text field will be the Site Name field. Further down the App will be a Toggle input (to allow or not allow external users) that if selected would need to append "External - " into the first Input Text field for the name of the site. One caveat to this scenario is that the appended text needs to be uneditable so that the user doesn't try to bypass the naming convention for External capable sites.

 

So far This is what I've done.

 

I have a Text Input field: "InputSiteName" 

The "Default" setting is set to "EXT_Toggle & " " "

 

I have a Toggle input: "ToggleExternal"

The "OnCheck" value is set to "UpdateContext({EXT_Toggle: "External -"})"

The "OnUncheck" value is set to "UpdateContext({EXT_Toggle: ""})"

 

This works to add the "External - " into the Name field but it removes the previous text and does not append it. How can I get this to append to whatever text is already in the name input field?

 

1 ACCEPTED SOLUTION

Accepted Solutions
ErikLa
Regular Visitor

I found solutions to my issues by using a Substitute and adding a readolny flag to the startup of the app.

 

These were modifications I used on the OnUncheck for the Toggle switch.

UpdateContext({EXT_Toggle: Substitute( "External - " & InputSiteName.Text, "External - ", "")});
Set(readOnlyFields,false);

View solution in original post

2 REPLIES 2
BrianS
Super User
Super User

It seems like that default would ignore the text input.

I think the default should be something like "EXT_Toggle & ThisItem.InputSiteName"

that will add the toggle value to the user input without showing that value to the user

 

ErikLa
Regular Visitor

I found solutions to my issues by using a Substitute and adding a readolny flag to the startup of the app.

 

These were modifications I used on the OnUncheck for the Toggle switch.

UpdateContext({EXT_Toggle: Substitute( "External - " & InputSiteName.Text, "External - ", "")});
Set(readOnlyFields,false);

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,348)