SOLVED

Hide HTML text based on field value

%3CLINGO-SUB%20id%3D%22lingo-sub-357137%22%20slang%3D%22en-US%22%3EHide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357137%22%20slang%3D%22en-US%22%3E%3CP%3EHello.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20that%20it%20is%20possible%20to%20hide%20a%20field(s)%20based%20on%20a%20field%20value.%26nbsp%3B%20Is%20it%20possible%20to%20hide%20part%20of%20an%20HTML%20text%20input%20based%20on%20a%20field%20value%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20added%20an%20HTML%20field%20to%20that%20contains%20some%20text%20that%20should%20only%20be%20present%20if%20a%20field%20is%20chosen.%26nbsp%3B%20For%20example%2C%20you%20have%20to%20apply%20for%20a%20visa%20and%20depending%20on%20your%20destination%2C%20you%20have%20different%20processes%20that%20you%20need%20to%20follow.%26nbsp%3B%20Choose%20Lebanon%2C%20you%20see%20the%20process%20to%20apply%20for%20a%20visa%20to%20Lebanon.%26nbsp%3B%20If%20you%20choose%20Africa%2C%20you%20see%20the%20process%20to%20apply%20for%20a%20visa%20to%20Africa.%26nbsp%3B%20So%20on%20and%20so%20on.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-357137%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357854%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357854%22%20slang%3D%22en-US%22%3EIt%20worked!%20*sigh*%20THANK%20YOU%20FOR%20ALL%20OF%20YOUR%20HELP!%20It%20is%20just%20too%20cool.%3CBR%20%2F%3E%3CBR%20%2F%3EBefore%20I%20read%20your%20last%20response%20I%20continued%20to%20mess%20with%20the%20formula%20and%20came%20up%20with%3A%3CBR%20%2F%3EIf(DataCardValue9.Selected.Value%20%3D%20%22Beirut%2C%20Lebanon%22%2C%20Set(embassy%2C%20true)%2C%20false)%20and%20the%20variable%20finally%20read%20as%20true.%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20was%20great.%20Thank%20you%20thank%20you%20thank%20you!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357848%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357848%22%20slang%3D%22en-US%22%3EIf%20they%20text%20is%20working%20then%20it's%20probably%20fine.%20You%20need%20to%20put%20logic%20in%20so%20when%20you%20select%20that%20value%2C%20then%20change%20it%20to%20something%20else%20the%20variable%20get's%20cleared%20or%20changed%20to%20something%20else.%20%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20on%20the%20If(DataCardValue9.Selected%2C'Lebanon%2C%20UAE'%2C%20Set(embassy%2C%20true))%20need%20to%20add%20an%20else%20in%20there.%20%3CBR%20%2F%3EIf(DataCardValue9.Selected%2C'Lebanon%2C%20UAE'%2C%20Set(embassy%2C%20true)%2CSet(embassy%2Cfalse))%20etc.%20Don't%20know%20how%20this%20is%20triggering%2C%20but%20something%20to%20consider.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357846%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357846%22%20slang%3D%22en-US%22%3E%3CP%3EWoohoo%20I%20was%20able%20to%20get%20the%20text%20to%20hide.%20Half%20the%20battle%20%3A-D.%20I%20checked%20on%20the%20var%20and%20it%20shows%20as%20%22No%20Value'.%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20is%20the%20OnSelect%20property%20for%20the%20field%20not%20the%20custom%20card%20%3D%20If(DataCardValue9.Selected.Value%20%3D%20%22Beirut%2C%20Lebanon%22%2C%20Set(embassy%2C%20true)%2C%20false).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357831%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357831%22%20slang%3D%22en-US%22%3EAnd%20I%20don't%20know%20if%20this%20is%20copy%20paste%20code%20but%20make%20sure%20you%20have%20quotes%20around%20the%20hidden%20text%20since%20you%20don't%20there%2C%20but%20guessing%20it's%20just%20a%20typo.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357829%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357829%22%20slang%3D%22en-US%22%3EYour%20variable%20probably%20isn't%20getting%20set%20because%20of%20the%20selected%20usually%20should%20be%20something%20like%20DataCardValue9.Selected.Value%20see%20if%20it%20lets%20you%20add%20that%20to%20the%20end.%20%3CBR%20%2F%3E%3CBR%20%2F%3EAlso%20when%20the%20app%20runs%2C%20and%20you%20select%20that%2C%20x%20out%20and%20go%20view%20the%20variables%20in%20the%20view%20menu%20and%20see%20if%20it%20has%20a%20true%20or%20false%20value%20set.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357824%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357824%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris.%20I%20am%20struggling.%20For%20the%20drop%20down%2C%20I%20have%20the%20OnSelect%20property%20as%20%3CSTRONG%3E%3CFONT%20color%3D%22blue%22%3EIf(DataCardValue9.Selected%2C'Lebanon%2C%20UAE'%2C%20Set(embassy%2C%20true))%3C%2FFONT%3E%3C%2FSTRONG%3E.%20So%20if%20Lebanon%2C%20UAE%20is%20chosen%20it%20will%20set%20the%20var%20embassy%20as%20true.%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20the%20HTML%20text%20input%20box%2C%20it%20surrounded%20the%20text%20that%20I%20wanted%20to%20be%20hidden%20with%20the%20%3CSTRONG%3E%3CFONT%20color%3D%22blue%22%3E%22%22%26amp%3B%20If(embassy%20%3D%20true%2C%20%22...(the%20hidden%20text)%2C%20%22%22)%20%26amp%3B%22%22%3C%2FFONT%3E%3C%2FSTRONG%3E%20but%20its%20not%20taking%20the%20code.%3CBR%20%2F%3E%3CBR%20%2F%3ECould%20you%20possibly%20tell%20me%20what%20I%20did%20wrong%3F%20I%20haven't%20worked%20with%20var%20before.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20again.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357790%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357790%22%20slang%3D%22en-US%22%3EThank%20you%20Chris%20for%20your%20response.%20I%20will%20test%20it%20out%20and%20return%20with%20the%20results.%3CBR%20%2F%3E%3CBR%20%2F%3EHave%20a%20wonderful%20day!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357150%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357150%22%20slang%3D%22en-US%22%3EYou%20could%20technically%20just%20use%20the%20IF%20statement%20as%20well%20in%20there%20surrounded%20by%20%26amp%3B's%20with%20the%20values%20direct%2C%20but%20might%20be%20easier%20to%20set%20the%20variables%20so%20you%20can%20change%20the%20values%20easier.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357149%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20HTML%20text%20based%20on%20field%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357149%22%20slang%3D%22en-US%22%3E%3CP%3EYou'll%20want%20to%20use%20variables%20here%20and%20plug%20in%20the%20text%2C%20and%20show%20that%20variable%20by%20wrapping%20it%20in%20an%20IF()%20function%20like%20so%2C%20with%20on%20%2F%20off%20checkbox1.value%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20826px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F84469iA59650DB98CBFD8C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22off.PNG%22%20title%3D%22off.PNG%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20936px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F84470i43FA1EEC4612AA0F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22on.PNG%22%20title%3D%22on.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello. 

 

I know that it is possible to hide a field(s) based on a field value.  Is it possible to hide part of an HTML text input based on a field value?

 

I added an HTML field to that contains some text that should only be present if a field is chosen.  For example, you have to apply for a visa and depending on your destination, you have different processes that you need to follow.  Choose Lebanon, you see the process to apply for a visa to Lebanon.  If you choose Africa, you see the process to apply for a visa to Africa.  So on and so on.

 

Thank you in advance!

9 Replies

You'll want to use variables here and plug in the text, and show that variable by wrapping it in an IF() function like so, with on / off checkbox1.value 

 

off.PNGon.PNG

 

 

You could technically just use the IF statement as well in there surrounded by &'s with the values direct, but might be easier to set the variables so you can change the values easier.
Thank you Chris for your response. I will test it out and return with the results.

Have a wonderful day!

Hi Chris. I am struggling. For the drop down, I have the OnSelect property as If(DataCardValue9.Selected,'Lebanon, UAE', Set(embassy, true)). So if Lebanon, UAE is chosen it will set the var embassy as true.

In the HTML text input box, it surrounded the text that I wanted to be hidden with the ""& If(embassy = true, "...(the hidden text), "") &"" but its not taking the code.

Could you possibly tell me what I did wrong? I haven't worked with var before.

Thanks again.

best response confirmed by Mellissa Perez (Occasional Contributor)
Solution
Your variable probably isn't getting set because of the selected usually should be something like DataCardValue9.Selected.Value see if it lets you add that to the end.

Also when the app runs, and you select that, x out and go view the variables in the view menu and see if it has a true or false value set.
And I don't know if this is copy paste code but make sure you have quotes around the hidden text since you don't there, but guessing it's just a typo.

Woohoo I was able to get the text to hide. Half the battle :-D. I checked on the var and it shows as "No Value'.

Here is the OnSelect property for the field not the custom card = If(DataCardValue9.Selected.Value = "Beirut, Lebanon", Set(embassy, true), false).

If they text is working then it's probably fine. You need to put logic in so when you select that value, then change it to something else the variable get's cleared or changed to something else.

So on the If(DataCardValue9.Selected,'Lebanon, UAE', Set(embassy, true)) need to add an else in there.
If(DataCardValue9.Selected,'Lebanon, UAE', Set(embassy, true),Set(embassy,false)) etc. Don't know how this is triggering, but something to consider.
It worked! *sigh* THANK YOU FOR ALL OF YOUR HELP! It is just too cool.

Before I read your last response I continued to mess with the formula and came up with:
If(DataCardValue9.Selected.Value = "Beirut, Lebanon", Set(embassy, true), false) and the variable finally read as true.

This was great. Thank you thank you thank you!