Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Hide fields with script
- This topic has 8 replies, 3 voices, and was last updated 4 years, 3 months ago by T.L. Ford.
-
AuthorPosts
-
July 9, 2020 at 7:17 AM #41234
Jean-Pierre HermansParticipantIs it possible to hide different fields with a script? And if yes, can someone give an example because this is complete new for me.
I have a checkbox and when it’s checked then some fields in that record needs to be hided.
Thank you.July 9, 2020 at 9:35 AM #41235
Daniel LeuParticipantYes, this can be done. Unfortunately, everytime you update your checkbox field, you have to click on
Recalculate Formulas
to get the update.Here is my field script:
var hide_field_id = 'fld-xxx'; var target_field_id = 'fld-xxx'; var field = form.getFieldWithId(target_field_id); var status = ''; if (record.getFieldValue(hide_field_id)){ field.hideField = true; status = 'hiding field'; } else { field.hideField = false; status = 'showing field'; } document.saveAllChanges(); status;
July 9, 2020 at 9:49 AM #41240
Daniel LeuParticipantAfter thinking about it a bit more, I don’t think using
hideField
for your purpose is the intended purpose! So most likely, this will not work for you.July 9, 2020 at 9:55 AM #41241
Jean-Pierre HermansParticipantWhat could then be a solution to hide fields when checkbox checked?
July 10, 2020 at 9:15 AM #41246
Daniel LeuParticipantWhy do you want to hide a field? It might be helpful to understand your intent.
July 18, 2020 at 10:34 AM #41361
T.L. FordParticipantTap Forms needs a javascript call to refresh the form display (similar to the View | Refresh Records List menu item). This would also solve a script on a many-side not correctly refreshing the view on the one-side.
Tried several ways (attached), but none are an acceptable solution.
Attachments:
You must be logged in to view attached files.July 18, 2020 at 11:27 AM #41367
Daniel LeuParticipantTap Forms needs a javascript call to refresh the form display (similar to the View | Refresh Records List menu item).
+1
I’ve been asking for such a feature for a long time… Nice to see someone else wanting it as well :)
July 18, 2020 at 4:14 PM #41372
T.L. FordParticipantMain use case for a form.refresh(); function (one-side summary/many-side data). See attached video.
You can get around the show/hide fields using the built-in section headers and the default form (although I did get a bug when it duplicated fields, but I think the form just wasn’t fully saved and it self-resolved).
Attachments:
You must be logged in to view attached files.July 19, 2020 at 6:58 AM #41379 -
AuthorPosts
You must be logged in to reply to this topic.