Section 5: IDs
At this point, you have a good understanding of how objects represent things in your Tap Forms database. You also have a good idea of how to look up and use object methods in the Tap Forms JavaScript API documentation.
Unique objects in Tap Forms have an ID. An ID is a system-generated long string of seemingly random letters and numbers that uniquely identifies each object in your database.
Every object has an ID. document, forms, fields, records, etc.
This is why, when you want to get a specific object, you use its ID. Ids are so useful that Tap Forms even has a way to easily add these to your script.
Using the IDs instead of the object names means you can rename things in your database without having to change your code and the function gets slightly more efficient because you don't have to call the get-object-by-name function as well as the getId() method.
Our last function can be redone, using only IDs.
The code gets shorter and faster, but becomes harder to read later, especially if you don't choose really good variable names.
Until you become savvy enough to decide which to use when, a general rule is to use
var frm = document.getFormNamed('formName');
along with
var fld_id = 'fld-longObnoxiousUnpronounceableString';
Tap Forms also has some fancy shortcuts to some specific objects, but we'll get to that.