SOLVED

Hide HTML text based on field value

Copper 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 (Copper 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!
1 best response

Accepted Solutions
best response confirmed by Mellissa Perez (Copper 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.

View solution in original post