Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 541 through 555 (of 2,989 total)
  • Author
    Search Results
  • #49555

    In reply to: Stepper

    Glen Forister
    Participant

    Thanks 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 2 years, 7 months ago by Glen Forister.
    #49553

    In reply to: Stepper

    Daniel Leu
    Participant

    First, 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 2 years, 7 months ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49551

    In reply to: Stepper

    Glen Forister
    Participant

    Thanks 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.
    #49549

    In reply to: Stepper

    Daniel Leu
    Participant

    Yes, 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-api

     

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49548

    In reply to: Stepper

    Glen Forister
    Participant

    If 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.

    #49547
    Daniel Leu
    Participant

    Have a look at following response to a similar question: https://www.tapforms.com/forums/topic/how-to-increase-a-date-in-a-script/#post-49372

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49544

    In reply to: Stepper

    Daniel Leu
    Participant

    Yes, 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 2 years, 7 months ago by Daniel Leu.
    • This reply was modified 2 years, 7 months ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49543

    In reply to: Stepper

    Glen Forister
    Participant

    That 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.

     

    #49521
    Daniel Leu
    Participant

    One benefit of exposing the API I could see is to use JavaScript code to build a custom layout by setting the coordinates, height, width, font settings, and so on. That would be an interesting idea too.

    That’s something I’ve been thinking about. This would be a way to visually show the progress of actions (quoted, P.O. received, parts ordered, in production, shipped, invoiced, paid) like changing the color of certain graphic elements, like big arrows, squares, rectangles, etc.

    • This reply was modified 2 years, 7 months ago by Daniel Leu.
    • This reply was modified 2 years, 7 months ago by Brendan.
    • This reply was modified 2 years, 7 months ago by Brendan.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49517
    Brendan
    Keymaster

    One benefit of exposing the API I could see is to use JavaScript code to build a custom layout by setting the coordinates, height, width, font settings, and so on. That would be an interesting idea too.

    #49506
    Pavel
    Participant

    Hi Brendan,
    I have this problem generally. Delete and replace field in layout is without effect.
    Maybe I make some stupid mistake. Simply script is here:

    function Fill_Match() {

    var ar_lv_r1_id = ‘fld-19384a3f4f1248ea82b16a9d4eee55e0’;
    var ar_lv_r2_id = ‘fld-68464406010642928be2d4722d5b73fa’;
    var ar_lv_r3_id = ‘fld-a09de8a68b6a4658bb030c677341a670’;
    var ar_hv_r1_id = ‘fld-15db9eb1f8be4797a7f787ee90d40d04’;
    var ar_hv_r2_id = ‘fld-47295e7cae1a46d6935848285ba24c82’;
    var ar_hv_r3_id = ‘fld-37dc77cbaf2941a285c76be51f14fa03’;

    record.setFieldValue(ar_lv_r2_id, ‘XXXX’);
    record.saveAllChanges;
    console.log(record.getFieldValue(ar_lv_r2_id));
    return;

    }

    Fill_Match();

    #49497
    Brendan
    Keymaster

    Also, you can have a Script Field just return its data and display it on a custom layout. You don’t have to set another field with the result just to display the result.

    #49488
    alang
    Participant

    Text can be placed on a Form as part of the layout using the “A” icon labeled: “Add text to your layout”. Is there a way to get an object id of that text object. This would be to change the text via scripting as you do with regular form objects. Thank you.

    • This topic was modified 2 years, 8 months ago by alang.
    #49481
    Brendan
    Keymaster

    You don’t need a separate field to contain the results of the Script field execution. You can just display the Script field directly because whatever you return from the Script will be displayed by that field. If the relationship field is the inverse of a One to Many (that is, a Link From Form field), then the Calculation field formula can also return that value and takes just a single double-click on the Formula Edit screen for the Calculation field.

    #49480
    alang
    Participant

    I see. Thank you. On the form I am linking to are several fields that are themselves, “Link To Form”. So they, of course, are not available to display in the popover (or the left of the child form itself). I do need some combinations to appear in the popover. For example, the child form used to populate the popover, called Sources includes books titles. A field on Sources is Authors, which itself, is a “Link To Form” (to Authors) since a book might have several authors. What I want to appear in the popover populated by Sources would be, for example, a principle author (identified somehow in the authors form) plus the book title. So given what you have said, I am thinking that I need to utilize either a calculation field or a script field to extract on the sources form, for each record, book title plus author. The scripting would need to select which author. I would take that title plus author and place it in a regular text field on the form, Sources (the child form that will populate the popover). This plain text field, populated by the script with author-title, would then appear as a field to select for the popover. If I managed to make that clear, does it sound like I am headed down a reasonable path? Or does a better approach come to mind? Thank you.

Viewing 15 results - 541 through 555 (of 2,989 total)