Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › Result from one field in another field – same form
- This topic has 4 replies, 3 voices, and was last updated 1 year, 9 months ago by Bil Stallman.
-
AuthorPosts
-
February 4, 2023 at 11:47 PM #48837
Bil StallmanParticipantI wish to fill a Web Site field with the result of a selection from a different field with a drop down list field in the same form. The drop down choices would be text but the link in Web Site field would be the web address.eg
Drop down choice would be Míele and result in web site field would be Míele’s web addressFebruary 5, 2023 at 3:35 PM #48842
BrendanKeymasterHi Bil,
Something like this could be done with a Script field that monitored the value from your field that contains the names and then sets a Website Address field to a website when you select it. Your script would probably have to have the list of corresponding website addresses in it though.
I’m not sure how well versed you are in JavaScript programming though.
You could also use a Link to Form field that contains a list of names and corresponding website addresses. Then when you assign the child record to your parent record, you would see the name and website address. The website address on the child form would be a Website Address field. At least you would want it to be.
Thanks,
Brendan
February 5, 2023 at 4:35 PM #48844
Bil StallmanParticipantThanks Brendan. I did have a go at scripting via the scripts tab but I have very limited JavaScript programming knowledge. It is something to learn. I will also play around with Link to Form. Maybe a more detailed look into the help sections.
February 5, 2023 at 5:40 PM #48845
Daniel LeuParticipantOne cool feature in TF is that picklist entries can come from a form. So I have a form called ‘Brands’ that contains name and URL fields. I select this form to be the source of my picklist. Then in my main form, I use that picklist to select the brand. Further, I use a field script ‘URL Script’ to set the value of the URL field. The field script is triggered whenever a different brand is selected and then the URL field is updated accordingly.
When the script is triggered, it fetches all entries of the ‘Brands’ form and loops through them. Once a match is found, the URL field is set according to that matching record entry and the script aborted:
function Url_Script() { var brand_id = 'fld-feb500eed99747169d8d90db3a620243'; var url_id = 'fld-0a342472ca0b44b1a52c3758c5be92e4'; const brands_name_id = 'fld-8d373c0912154c69a7f579e696cd598c'; const brands_url_id = 'fld-0a342472ca0b44b1a52c3758c5be92e4'; let brand = record.getFieldValue(brand_id); // get the brands form. Note that the name of the form must match! let brandsForm = document.getFormNamed("Brands"); for (let rec of brandsForm.getRecords()){ if (rec.getFieldValue(brands_name_id) == brand){ let url = rec.getFieldValue(brands_url_id); console.log("found match: " + brand) + " with url " + url); record.setFieldValue(url_id, url); document.saveAllChanges(); return url; break; } } } Url_Script();
Hope this is what you were looking for. I have attached my example document.
Attachments:
You must be logged in to view attached files.February 6, 2023 at 11:59 PM #48855
Bil StallmanParticipantThank you Daniel
Just what I am trying to do. Thank you for the insight and codes. I will try it tomorrow -
AuthorPosts
You must be logged in to reply to this topic.