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 - 46 through 60 (of 2,991 total)
  • Author
    Search Results
  • #53077
    David White
    Participant

    I’m not totally clear what a loop is. But I think I got it out of the loop. I’ll paste what I did here. If I did it right… the script still is not working. It’s doing the same thing… It’s only blanking out Day 2 checkmark, and not Day 1 checkmark.

    Here’s what I did.

    function uncheckRecords() {

    // get the ID of the form you want to get the records from
    var myForm = document.getFormNamed(‘Reset Check’);

    // get the ID of the checkbox field
    var checkMarkField = ‘fld-f9318c6c66944131b69e29e75ab996db’;
    var checkMarkField = ‘fld-3adc2a737f9f468b8bb6be8327c9139d’;

    // get the records from that form
    var records = myForm.fetchRecords();

    // iterate through all records and set the charkMarkField to unchecked
    for (var index = 0, count = records.length; index < count; index++){
         // pull single record from array:
         var theRecord = records[index];
         // change field value for that record
         theRecord.setFieldValue(checkMarkField, 0, false);
    }
    document.saveAllChanges();
    }
    uncheckRecords();

    #53071
    David White
    Participant

    Oh… so close. I made the change: myForm.getRecords()… to: myForm.fetchRecords().

    It stopped the Error Message, and when i clicked on the script it even unchecked one of my two check boxes. It unchecked: Day 2. But not: Day 1.

    I will copy and paste here my script. Hope it helps make sense of it. In the script… First Field ID is Day 1. Second Field ID is Day 2. ( Only Day 2 checkbox resets ). My script below.

    function uncheckRecords() {

    // get the ID of the form you want to get the records from
    var myForm = document.getFormNamed(‘Reset Check’);

    // get the ID of the checkbox field
    var checkMarkField = ‘fld-f9318c6c66944131b69e29e75ab996db’;
    var checkMarkField = ‘fld-3adc2a737f9f468b8bb6be8327c9139d’;

    // get the records from that form
    var records = myForm.fetchRecords();

    // iterate through all records and set the charkMarkField to unchecked
    for (var index = 0, count = records.length; index < count; index++){
         // pull single record from array:
         var theRecord = records[index];
         // change field value for that record
         theRecord.setFieldValue(checkMarkField, 0, false);
         document.saveAllChanges();
    }

    }

    uncheckRecords();

    • This reply was modified 3 months, 1 week ago by David White.
    #53070
    Brendan
    Keymaster

    try myForm.fetchRecords(). In Tap Forms Pro I had to rename the getRecords() function to fetchRecords().

    Sorry, I missed seeing that in the script above.

    #53069
    David White
    Participant

    Hello Shane and Brendan.

    First I want to thank you both for your help.

    I got scared I was going to mess up my CWL WARs Form … so I made a practice form that does kinda the same thing.

    My practice Form is called: Reset Check. And I made only two checkboxes name: Day 1 and Day 2.

    I put your Script in and where it says:
    Var myForm = document.getFormNamed( ‘Reset Check’);

    As you can see I put: Reset Check.

    I put in the IDs For: Day 1 and Day 2.

    Everything seems to work … except I get this message that pops up:

    ERROR
    TypeError: myForm.getRecords is not a function. ( In ‘myForm.getRecords(); ‘myForm.getRecords’ is undefined), line:(null)

    I have no idea what that means. I was hoping it would work. I don’t know what to do to fix that.

    Hoping you might have a trick up your sleeve that can make this script work.

    Note: As I mentioned in the beginning… I only use IOS iPhone and iPad. I don’t have a Max Lap Top. Hoping it doesn’t matter. I am using Tap Forms Pro app i purchased. Thats why i chose this Forum. If i’m not suppose to be here… let me know. I will post my questions where i’m told to go.

    Thanks.
    God Bless.

    #53068
    Brendan
    Keymaster

    Looks good to me Shane. Just make it as a Form script and run it whenever you want to uncheck all the records in the form. It won’t run automatically when the form is viewed.

    #53066
    Mark Moran
    Participant

    Hi!

    Refining this again. It seems to run repeatedly as I scroll through the fields in a record. I added this to prevent this:

    // — Only proceed if variety field is empty —
    if (variety) {
    return; // Exit if variety is already set
    }

    Once it’s filled in it stops prompting for the variety. But….. I’d like the script to give me a prompt not if the field is empty but if that’s the active field. Is there any API call like:

    record.getActiveRecord();

    ?????

    Mark

    #53065
    Shane
    Participant

    That’s a difficult thing to easily explain in layperson’s terms because it requires explaining a programming language. I”m new to scripting in TapForms, but have some experience with Javascript via web programming.

    You need to create a script field which gets run when the form is viewed (I believe). In the script, it would have to do the following:

    function uncheckRecords() {
    
    // get the ID of the form you want to get the records from
    var myForm = document.getFormNamed('CWL WARS');
    
    // get the ID of the checkbox field
    var checkMarkField = 'fld-11d1cd0f0dc64bc389c3298076f0b9c8';
    
    // get the records from that form
    var records = myForm.getRecords();
    
    // iterate through all records and set the charkMarkField to unchecked
    for (var index = 0, count = records.length; index < count; index++){
         // pull single record from array:
         var theRecord = records[index];
         // change field value for that record
         theRecord.setFieldValue(checkMarkField, 0, false);
         document.saveAllChanges();
    }
    
    }
    
    uncheckRecords();

    So this is how I see the code going in theory, but I haven’t tested it. I’m assuming that a check mark field would result in 0 (unchecked) and 1 (checked) just like a form would in Javascript but haven’t verified it in Tapforms. There are some other changes I’d make to this code to make it more efficient (such as an if then conditional to only change the records that are already checked) but for simplicity purposes I kept it this way.

    Good luck.

    #53064
    David White
    Participant

    I play a mobile game called Clash of Clash on my iPhone 13. I use Tap Forms Pro on my iPhone also. I made a document named: My Games, and a form inside that named: CWL WARs, and inside that I made records that use 7 Check Mark Fields… Names: Fought Day 1, Fought Day 2, Fought Day 3, Fought Day 4, Fought Day 5, Fought Day 6, Fought Day 7. My Question is this: How can I make a Script on my iPhone 13 that will reset or clear all those Check Mark fields back to no checked boxes again. I am new at making scripts … so can you put it in Layman Terms as much as possible. I did read the beginner stuff tap forms puts out. So I got the very basic. My reason for wanting to do this is as follows. I can have 40 players I’m tracking during CWL WARs at any given time. Each record has 7 Check Mark boxes that can be clicked on. That’s 40 X 7 = 280 Check Mark Boxes I have to clear at the end of CWL WARs. It would be so much easier if I could just click a script and they were all reset / cleared at once.

    Hope to hear back from someone that can help me. First time using this Forum. Thanks. God Bless.

    #53058
    Brendan
    Keymaster

    Hi Aaron,

    There won’t be an Apple Silicon version of Tap Forms 5 because in the two years that I spent working on Tap Forms Pro, I removed some third party libraries that were Intel based in order to be able to make Tap Forms Pro Apple Silicon native.

    Tap Forms Pro is the future of Tap Forms, but I have updated Tap Forms 5 just recently to make it continue to function properly on macOS Tahoe where there were a couple issues. I won’t be able to do that indefinitely though as in a couple of years Apple will no longer support Rosetta on Apple Silicon Macs. Tap Forms 5 requires an Intel Mac or Rosetta to run.

    As far as the subscription model is concerned, I have responded to this question a couple times already in this forum.

    Thanks,

    Brendan

    #53057
    Aaron Rolls
    Participant

    I asked years ago if we could get a native version of Tap Forms 5 for Apple Silicon. I was told that yes it would happen, the dev was just waiting as they did not yet own a Apple Silicon device.

    What we ending up receiving was a subscription based version of tap forms which I have no interest in. I’d be happy to pay for an upgrade though.

    Could we get a native version of Tap Forms 5?

    Either that or could we have a change to the tap forms pricing model from what it is now to a update subscription. What ever version you have you keep but you pay for a year of updates?

    #53053
    Brendan
    Keymaster

    I’m glad you found a solution using scripts.

    #53043
    Harry
    Participant

    Since a calculation field didn’t work, I used a script field instead and that worked.

    • This reply was modified 3 months, 3 weeks ago by Harry.
    • This reply was modified 3 months, 3 weeks ago by Harry.
    #53023

    In reply to: Pricing Model

    Brendan
    Keymaster

    Hi Steve,

    Thank you so much for your very kind words and feedback.

    There are certainly apps that I subscribe to myself that don’t provide their own back-end services. Such as Sketch, Tower Git Client, and Sleep Cycle to name just a few. I pay the subscription fees because they continue to improve and support their apps and I benefit from that. And to help support the continued development of their apps.

    What if I said “here’s an app for a one-time fee, but you can never ask me a question about it, I won’t provide a support forum, and I’ll never release new features, bug fixes, or improvements”. I’m sure not many people would like that. I wouldn’t like that.

    Even though it doesn’t seem like it for Tap Forms, there are ongoing costs for me to continue developing, supporting, and marketing it (and hosting my domains, email, and website).

    In my entire history of 17 years of Tap Forms development, I had only ever had one upgrade charge when I released Tap Forms 5. And customers were entitled to a 50% discount, as they are on the first year of Tap Forms Pro. That was pretty good value in my opinion.

    Also I haven’t removed Tap Forms 5 from the App Store, so you can certainly get that version for a one-time fee and I am happy to support you for as long as you own it.

    I realize subscriptions aren’t for everyone and you do have options with Tap Forms 5, or if you value my continued development of Tap Forms, then you could subscribe to Pro.

    I want to continue developing Tap Forms for as long as customers keep enjoying using it, and subscriptions allow me to continue to do that.

    Thanks,

    Brendan

    #53022

    In reply to: Newbie Questions

    Brendan
    Keymaster

    Oh, as for ChatGPT helping you to write scripts, I think some customers have had some success with it. It can hallucinate though. What are you attempting to accomplish with your script?

    #53015
    Glen Forister
    Participant

    I have a field (Date Type) = “Date Collected” containg a collection date (mo/day/yr. = 07-29-10
    .
    I want another field to take that date and supply the “Day of Year”.

    I’ve looked at the functions, etc., and can’t find a way to do this. The discussion about date indicate that the way it is created is not accurate and therefore they don’t give a solution. However, I don’t care if the result is not exactly accurate, but I need it to be simple and accurate to within a few days.
    Can this be done with a calculated field or does it have to be a script?
    If it has to be a script, can you please supply me with when that will work since I’m not able to do that.

    I want to then be able to sort all my data by the day of year so that I can see which insects are collected during whatever period in year.
    Thank you

Viewing 15 results - 46 through 60 (of 2,991 total)