I'm creating an inventory manager (excel backend). I have a textbox on my edit screen who's default is supposed to be 0 every time they enter the edit screen. It's not linked to any data field, just used for calculations. (Red arrow is pointing to it.)
So, basically when I put a value in this text field, automatically this value is added to the current qty and the new number is displayed (in green). (I'm basically saving the green number to the excel backend.)
Here's the problem: When I go in the screen the very first time it's '0'. But, after I put in a number, save/exit the form, then re-enter the form the value I typed in is retained. How do I get it to reset each time?
Solved! Go to Solution.
For a control in a form to get back to the default value the form needs to be reset using ResetForm.
See if the following works:
TextInput.Default = 0
Then on any control where you are navigating away from that screen add:
;ResetForm(EditScreen1)
including the semicolon.
It looks like you are using the template that is automatically generated when you select a data source, so you might see that ResetForm is already there on the X icon.
try replacing the value through onscreenvisible
eg: textbox1.value=0 in the onscreenvisible parameter
You can bind the Text input control to a context variable (TextInput1.Deafult = vvv) and then reset it when needed. Is your form in a separate screen? If so then you can Screen2.OnVisible=UpdateContext({vvv:0})
I went to the OnVisible property of my edit screen and put in
DataCardValue7.text = "0"
but it didn't show work. It still showed the former value.
Have you tried the binding method?
Trying to figure it out now.
I'm from a .NET background so this is kind of confusing. haha
Another way you can try is to create an updatecontext to run in onvisible
UpdateContext({textbox1value: "0"}) -onvisible
in the default of textbox1, textbox1value
you can even add a new updatecontext to the onselect of the textbox so it clears the value when selected.
onselect- UpdateContext({textbox1value: ""})
I
@aearioweu wrote:Another way you can try is to create an updatecontext to run in onvisible
UpdateContext({textbox1value: "0"}) -onvisible
in the default of textbox1, textbox1value
you can even add a new updatecontext to the onselect of the textbox so it clears the value when selected.
onselect- UpdateContext({textbox1value: ""})
I see what you're recommending and I tried it but it still didn't work.
On my edit screen's OnVisible I put: UpdateContext({QtyDefault:""})
Then in my actual textbox's Default action I put: QtyDefault
It works the first time. But after I enter a value, save, and re-enter the form the new textbox's value is still preserved.
Are you changing screens when you save? If not this wont work.
You'll need to add the updatecontext command after you press the save button
I have 2 screens: A main screen, which is the list of the main items and an edit page.
After I make an edit on the edit page I hit "save" and it goes back to the main screen.
The problem is when I try to edit another record. The last "qty" is there.
User | Count |
---|---|
140 | |
133 | |
79 | |
75 | |
74 |
User | Count |
---|---|
210 | |
200 | |
71 | |
66 | |
55 |