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 Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,424)