Typo in Tap Forms JavaScript API

Viewing 7 reply threads
  • Author
    Posts
  • August 18, 2020 at 8:32 AM #41690

    T.L. Ford
    Participant

    record.setNoteFieldValue() needs a ‘ in the example.
    record.setNoteFieldValue(field_id, ‘note_value’);

    August 18, 2020 at 11:28 AM #41695

    Brendan
    Keymaster

    Oops. Thanks! I fixed it.

    August 18, 2020 at 12:52 PM #41698

    T.L. Ford
    Participant

    Sorry – also:

    document object has a .name property.

    (I’m working on an object tutorial and crawling through the API.)

    August 19, 2020 at 4:21 PM #41702

    T.L. Ford
    Participant

    field.defaultValue property needs to be added to documentation.

    August 19, 2020 at 8:54 PM #41705

    Brendan
    Keymaster

    Oops again. Yes, I just added document.name; to the manual.

    But field.defaultValue; was already in the documentation.

    August 20, 2020 at 12:00 AM #41706

    T.L. Ford
    Participant

    Thanks! The defaultValue documentation version just hasn’t gotten to me yet, but I used it anyway for faster data entry with a couple sometimes-repetitive fields. I really adore Tap Forms and it’s wonderful that you are actively working on it.

    Script field code below is provided for other people who might find it useful. As a record gets added, the default value changes to the current data so it isn’t necessary to enter it on subsequent records unless the value changes (i.e. it’s easy to enter multiple books by the same author purchased in the same year).

    function Change_Default_Values() {
    
    	var author_id = 'fld-d3d7e4d8d3104c70a002ba5016f597c1';
    	var year_id = 'fld-a6fa7f9e718640d0b52c6f3baa5a40db';
    
    	var author_fld = form.getFieldWithId(author_id);
    	var year_fld = form.getFieldWithId(year_id);
    
    	var author = record.getFieldValue(author_id);
    	var year = record.getFieldValue(year_id);
    		
    	if (!author) { author = ""; }
    
    	author_fld.defaultValue = author;
    	year_fld.defaultValue = year;
    	
    	document.saveAllChanges();
    
    }
    
    Change_Default_Values();
    August 22, 2020 at 5:53 PM #41723

    Sam Moffatt
    Participant

    That’s a really cool way of using the default value option to help autofill new records. I might have to pinch that :D

    August 24, 2020 at 9:39 AM #41731

    T.L. Ford
    Participant

    Pinch away! I may include it in the object tutorial, depending on how many examples I get to.

Viewing 7 reply threads

You must be logged in to reply to this topic.