Hi John,
No, that’s not normal.
Maybe try running the Re-build Search Index function in the Tools menu. Do you have any Script Field or Calculation Fields that are run when you edit your Note fields? That could cause a delay.
Thanks,
Brendan
Glad you figured it out. Just re-reading your script a little more closely you did define the same checkmark variable name with two different IDs and your final version shows different variable names, which is correct.
Sorry I didn’t examine it more closely before.
A loop is the for (....) { } structure in your code. You don’t want the call to save within that because it’ll cause a refresh every iteration through the loop.
I’m glad you figured it out.
Sometimes programming is just trial and error. But through each iteration, you learn more and know what to look for the next time so you don’t make the same mistakes again.
Hey Guy’s I got this thing working now. I researched through Google AI. It took a ton of trial and error… but i finally got it. Remember in the javascript… Reset Check was my form i made. Day 1 and Day 2 was my checkboxes. Blank was the name of my Script.
I just wanted to click on my script ( named Blank ) one time, and Day 1 and Day 2 checkboxes ( In ALL my records at once ) would reset. The following pasted javascript does that for me now.
// Function to clear all checkbox fields in every record
function BlankAllRecords() {
// Get all records from the current form
var allRecords = form.fetchRecords();
// Field IDs for your checkboxes. These are unique to your form.
var day1FieldId = ‘fld-f9318c6c66944131b69e29e75ab996db’;
var day2FieldId = ‘fld-3adc2a737f9f468b8bb6be8327c9139d’;
// Loop through each record in the form
for (var i = 0; i < allRecords.length; i++) {
var aRecord = allRecords;
// Set the value of the checkbox fields to 0 (unchecked) for the current record
aRecord.setFieldValue(day1FieldId, 0);
aRecord.setFieldValue(day2FieldId, 0);
}
// Save all changes after looping through all records
document.saveAllChanges();
// Optional: Add a message to the console for debugging
console.log(“All records have been reset.”);
}
// Run the function
BlankAllRecords();
Hope this helps others in some small way.
Thanks Shane and Brendan.
God Bless guys.
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();
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 2 weeks, 1 day ago by
David White.
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.
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.
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.
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
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.
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.
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
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?
I’m glad you found a solution using scripts.
Since a calculation field didn’t work, I used a script field instead and that worked.
-
This reply was modified 3 weeks, 6 days ago by
Harry.
-
This reply was modified 3 weeks, 6 days ago by
Harry.