iPad text entry requiring user to hit enter on keyboard to pass param values

I have a text field template with a change script of self.view.params.value = currentValue.value

When I use a computer to complete the data entry the param value passes through and gets entered into the database. If I use an iPad, the value does not get updated unless the user hits enter on the keyboard or clicks off the text field first. How do I fix this so the value updates on the iPad? I even made deferUpdates false.

This sounds like Perspective scripting, would you mind updating the topic with the correct tag to direct people looking to help? :smiley:

Also was halfway through a response about 'deferUpdates' when your second edit came through, haha, back to the drawing board for me.

Once the parameter is successfully passed through, what is driving the database entry?

I'm worried if the entire exchange (pass param and enter to DB) is fired from updates in the text field with updates deferred, you'll run into issues where the script fires multiple DB queries as you type in the text field: i.e.: typing TEST into the text field will enter
T
TE
TES
TEST
into the DB, because the text field contents are passed and entered each time a new letter is typed.

I'm not very familiar with Perspective and spend most my time in Vision, so someone please correct me if I'm making wrong assumptions here. Also, this very well may not be how the DB query is fired, just a potential secondary issue that jumped out at me, and if this is the structure you might want updates deferred.

It is a button press, the button references what was entered into the text field, but I don't think there is enough time for it to recognize the value has updated once the text field is clicked off from by action of pressing the button.

That makes sense. It might be smoother to set the query up as a Named query and invoke system.db.runNamedQuery within the change script, after the param is passed. This way would require deferred updates, users would still have to hit enter/click away, but would remove the button press.

To my knowledge this would also ensure the value updates correctly before firing the query: in the current case two 'different' actions fire steps (clicking away updates the param, button click updates the DB). These two 'different' actions happen from the same single click of the mouse, but there's no way to ensure one fires before the other. Lumping them into the same action might give you more control over the order of execution.

well now it works, I changed the script to currentValue.value = self.view.params.value and made deferUpdates false :woman_facepalming:

2 Likes

Haha great, glad it's up and running!