I love using the gallery selection to get values that I will use in my submit and/or patch functions. However, when I come back to the screen after performing my actions, I'd like to screen to start fresh without any selections.
How, do I clear the gallery selected items onvisible for my screen?
Use Case:
Gallery1 is full of items from data source on screen1
Text1.Text is defaulted to Gallery1.Selected.Value.Field
After the first click on Gallery1 Text1.Text shows the correct value
I submit, and navigate to confirmation screen
I return to screen1
but I want Text1.Text to be blank again
....so I would like to know how to clear the gallery selection
Thank you in advance for your help!
Solved! Go to Solution.
Easy:
Gallery1.Default = DefaultSel
Screen234.OnVisible = UpdateContext({DefaultSel: Gallery1.Selected}); UpdateContext({DefaultSel: {}})
I hope this helps.
Hi
I wish I understand your scenario.
You are mentioning Text1.Text (is that TextBox or TextInput?)
Anyway, if you wish (either Box or Input) to be "Clear", then there are several ways:
1. Select Text1.Text, and set the Reset = SubmitButtom. Pressed
- When you click on Submit Button, it will trigger RESET (for Text1.Text) to clear the content of Text1.Text
Or, another option
2. Select Text1.Text, and set the Default = any context variable, say, Default = clearvalue
and set the OnHidden = UpdateContext({clearvalue: false}); UpdateContext({clearvalue: true}).
So, when you navigate away from the Text1.Text screen, it will be updated with "true" to clear the contents.
Hope I have answered to the right question.
Have a nice day.
Easy:
Gallery1.Default = DefaultSel
Screen234.OnVisible = UpdateContext({DefaultSel: Gallery1.Selected}); UpdateContext({DefaultSel: {}})
I hope this helps.
hpkeong: thank you so much - I will be using your first suggestion for all my "Comments" input text boxes! works wonderfully
rgruian: thank you so much! your suggestion worked wonderfully for my text boxes that are reading selections from the gallery as a default!
You guys are awesome!
@rgruian I tried your solution to clear gallery selection. It works but it is also giving error Expected: "CurlyClose". Found: "ParenClose"
UpdateContext({GalleryReset:{}})
Any help would be much appreciated
@rgruian wrote:Easy:
Gallery1.Default = DefaultSel
Screen234.OnVisible = UpdateContext({DefaultSel: Gallery1.Selected}); UpdateContext({DefaultSel: {}})
I hope this helps.
I'm not getting this;
I have a display form with basically the same requirement.
There is no displayform.default property - would I have to do this for each and every card value.default on the form?
I was kind of hoping for a form.ResetForm function there somewhere....I also have custom defaults, so using context variables for defaults makes for a very tedious operation.
Not serious, just annoying to have to see old data sit there for a few seconds while it updates with new data. Sometimes confusing, especially to users.
Hi @Anonymous
As @rgruian mentioned, and shared:
Gallery1.Default = DefaultSel
Screen234.OnVisible = UpdateContext({DefaultSel: Gallery1.Selected}); UpdateContext({DefaultSel: {}})
..I would suggest if you can try on Screen234.OnHidden so that it will disappear when you left the screen and on return, it is totally clean.
Please try it out.
TQ
Thanks hpkeong, but either I'm missing something, or you're missing something.
You're talking about a Gallery, I'm talking about a display form.
As far as I'm aware, there is no Default property for a display form at the form level...there are only default properties for each card and value. Typically the card is set to ThisItem.ColumnName and the value is set to Parent.Default (parent being the card)
ThisItem is the Item selected by the Gallery on another page.
It's not the Gallery I want to clear, it's the Display form.
I could possibly do this for each card value and set a context variable for the default - I'm pretty sure it would work much like the gallery default as per your example, but I haven't bothered testing that because it's tedious and messy. While I'm only showing about eight display fields, I have about twenty to choose from. I don't want to have to do this for each field I add or remove and add again....
This might be one for the ideas forum - form-level default for all cards, or simply the ability to reset the form (which currently only works on edit forms, not display forms)
Kind regards,
R
User | Count |
---|---|
252 | |
106 | |
88 | |
51 | |
44 |