This script:
var t = form.getFieldNamed(‘P1’);
console.log(t.name);
console.log(t.fieldType);
console.log(t.fieldDescription);
console.log(‘eoj’);
This is the console panel
undefined
undefined
undefined
eoj
In the Form there is a P1 field.
What’s wrong?
Thanks.
Can you add a property field_id?
For make indipendent scripts From Forms, and indipendent by database, i need a function like this:
Form.getfieldid(‘name Of field’);
And return the field_id ‘fld…’ without open snippets.
Gianantonio
Thanks.
Can you add a property field_id?
For make indipendent scripts From Forms, and indipendent by database, i need a function like this:
Form.getfieldid(‘name Of field’);
And return the field_id ‘fld…’ without open snippets.
Gianantonio
There’s no scripting support for adding to the Calendar.
The very first field in your form is what’s used to generate the default Title value. You can edit the title value of course before clicking the Add to Calendar button. The link to the record is also added to the calendar.
Hi Gianantonio,
Right now the only things exposed are the name, fieldType, and fieldDescription properties.
I updated the JavaScript API to document the new APIs I added:
https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api
I just wanted to register another request for custom layouts in iOS.
I’m getting by for my use case by creating scripts to summarise information, which is a fantastic ability, but it’s a bit fiddly and not for everyone.
I do love the scripting, though.
How can I automatically enter my desired fields in the calendar?
And can an appointment also be automatically entered in the calendar?
Can I use a script for this? If so which code? Does anyone have any idea?
Please can you tell me the tffield’s struct?
Thanks
Gianantonio
Hi Victor,
The next update will support letting you reference another Script field within a script.
Thanks,
Brendan
Brendan,
In this post you showed how it is possible to use fields from a related Form.
I am adapting the JavaScript code in other fields.
But when I am in Edit Script, the list of fields of all Forms do not show any fields which are Script fields – so I cannot access them to declare their IDs.
Is there a way to do so?
I think I’m going to have to rethink how that deviceName property works. As you edit the records, the device name is stored on the record that edited it. But the script field also needs to be updated to show the deviceName value. And that causes a save to the database, which of course updates the database. I think I’m going to have to perhaps add something to the Script field that prevents it from updating the database, but to merely display the results. So maybe for now this is not going to work for you. Especially since if anyone else were to cause a Calculation field or a Script field to refresh across all records, they would effectively be updating every record, causing the deviceName property to be changed to their name.
Tap Forms was never designed to be a multi-user database system and this was just a bit of a hack to see if I could display the name of the device that last made an edit to the record. It clearly needs some more thought and work.
Sorry for getting your hopes up that this would be a viable solution.
Hi Stephen,
Yes, that’s right. Or you can just use this script:
function Device() {
return record.deviceName;
}
Device();
Try clicking the Refresh button at the bottom of the records list. You should see the value appear.
Thanks,
Brendan
Hi Brendan,
Thanks for the response. Do I simply create a ‘script’ type field and enter the text as you’ve written?
I have attempted exactly that with the result set as text and I do not see anything in the form.
Have I skipped an obvious step?
Many thanks, Stephen.
Hi Stephen,
If you add a Script field that returns record.deviceName;
, that will display the name of the device that created the record.
Hi Steve,
You can access a Location field value from a Script field. The location field value will end up being a dictionary that you can reference like this:
var location_field_id = 'fld....';
var location_value = record.getFieldValue(location_field_id);
var title = location_value['title'];
var latitude = location_value['lat'];
var longitude = location_value['lon'];
// now you can do whatever you want with the values
The script can only get the values from a Tap Forms field. It doesn’t have a way to get the geo location coordinates itself. So you just need to add a Location field to your form and then let Tap Forms get the location for you for that field. Or of course you can set it to whatever location you want. Now once you have the location value, then the script can get access to the data.
Your friend will need Tap Forms because there are specific Tap Forms functions that he’ll need access to.