- This topic has 10 replies, 3 voices, and was last updated 1 year, 4 months ago by Glen Forister.
-
AuthorPosts
-
June 3, 2023 at 9:06 AM #49535
Glen ForisterParticipantThe input con”Stepper” allows the +/- control to change the number.
After I’ve incremented the number to 20 or 30 or more, is there a way to get back to zero without stepping all the way back to zero?
June 4, 2023 at 12:46 AM #49538
BrendanKeymasterHi Glen,
If you tap and hold on the
-
button just right, it’ll decrement more quickly. But you can get into the negative quickly too.June 5, 2023 at 1:49 PM #49543
Glen ForisterParticipantThat method is not reliable and the Edit Field comment comes up. It only works if I’m shaky enough to get rapid touches.
Would a Scrip to it easier? No, I don’t have the time to learn Script – I tried, but I can’t dedicate enough time to it.
June 5, 2023 at 2:46 PM #49544
Daniel LeuParticipantYes, this can be done with a form script. You just need to replace
fld-xxx
with the field if of your stepper field.function Reset_Stepper() { var stepper_id = 'fld-xxx'; record.setFieldValue(stepper_id, 0); document.saveAllChanges(); } Reset_Stepper();
- This reply was modified 1 year, 4 months ago by Daniel Leu.
- This reply was modified 1 year, 4 months ago by Daniel Leu.
June 5, 2023 at 3:59 PM #49548
Glen ForisterParticipantIf I’m guessing right, the “record.setFieldValue” will activate and change only one record of the Form?
I definitely don’t want to reset all the records, only the one I’m viewing.
I tried to look at Scripting docs I have and couldn’t find
record.setFieldValue defined to verify this.
I’m guessing setFieldValue is an action taken on a record.
June 5, 2023 at 5:00 PM #49549
Daniel LeuParticipantYes,
record.setFieldValue()
takes action only on the current record. Here is the link to the JavaScript API documentation: https://www.tapforms.com/help-mac/5.3/en/topic/javascript-apiJune 5, 2023 at 6:43 PM #49551
Glen ForisterParticipantThanks for the confirmation.
Another question. I have two fields in this Form that has steppers. I assume I have to have two scripts which are housed in the Scripts Tab next to the Fields tab.
Attached is the error message.
Attachments:
You must be logged in to view attached files.June 5, 2023 at 8:38 PM #49553
Daniel LeuParticipantFirst, you got to remove following two lines to fix the error you got:
Reset_Stepper(); }
Would you like to reset the two values at the same time? If yes, then it can be done with one script, otherwise two separate scripts.
Here is the template for two fields:
function Reset_Stepper() { var field1_id = 'fld-xxx1'; var field2_id = 'fld-xxx2'; record.setFieldValue(field1_id, 0); record.setFieldValue(field2_id, 0); document.saveAllChanges(); } Reset_Stepper();
- This reply was modified 1 year, 4 months ago by Daniel Leu.
June 5, 2023 at 9:21 PM #49555
Glen ForisterParticipantThanks for the syntax help. Yep, that works.
I notice an option to record a record shortcut. On an iPhone, what kind of shortcut would work that would be quicker than going into the “Run a Script” menu? The only thing I can think of is to go into another field and type “z”. Kinda lame and it leaves something to clean up, but easier than the full menu to script run.
Oops, in the manual, it looks like Menu Shortcut only works on the Mac, not the iPhone…
- This reply was modified 1 year, 4 months ago by Glen Forister.
June 5, 2023 at 11:29 PM #49557
Daniel LeuParticipantOn the iPhone, you can have Shortcuts as well. They use the shortcut app and work together with Siri. You can launch a scripts using them. I never used this as I barely us TF on my phone. Sam has a video where he shows how he uses Shortcuts. I hope this helps you get started: https://www.youtube.com/watch?v=B7oiWtRRuNY&t=559s&ab_channel=pasamio
June 6, 2023 at 8:38 AM #49561
Glen ForisterParticipantInteresting. I’ve looked at shortcuts, but never needed one and it didn’t seem simple to do, but when I have the time I’ll look at it again – tempting.
Thanks.
-
AuthorPosts
You must be logged in to reply to this topic.