iFormBuilder JavaScript Tips & Tricks
What's covered:
What is the Attachment element?
The Attachment element allows you to link files (PDF, MOV, MP4, HTML) to your mobile device's local database or external web content (connection required) within your form.
PLEASE NOTE: You must be connected to the internet for attachments to load.
How do I create a Dynamic URL?
To dynamically populate a URL in the Attachment element, please follow the instructions below. In the below example we are capturing address information to populate a Google map.
STEP 1. Add four Text elements to your form with the following data column names.
- my_street
- my_city
- my_state
- my_zip
STEP 2. Add an Attachment element to the form.
STEP 3. Under the Element Properties tab, put the following in the Attachment Link field:
http://maps.google.com/maps?q=${my_street}+${my_city}+${my_state}+${my_zip}
STEP 4. Save your form.
STEP 5. Fill out the text fields on your device, and then click the Attachment Widget.
Download the Form Package at the bottom for a sample form of this functionality.
Comments
4 comments
Please note that passing data from a Text field to Attachment Link will fail if you only put ${data_column_name} and nothing before it. I'd suggest putting: "https://${data_column_name}"
If you would like to implement this with Latitude and Longitude coordinates instead of Street Address you can pass in the following URL
http://maps.google.com/maps?q=${my_lat},${my_long}
For this to work you must have columns my_lat and my_long on the form and they must have valid coordinates in them.
Thanks!
Ben,
I tested this out 4-11-19 and EUREKA!!, the lat, long thing worked. Today (5-2-19) not working. I have not changed any criteria in the form or the input data. Any thoughts?
Hi Gwen,
Sorry to hear of your troubles. I just tested this on my Android and iOS device and it worked as expected. Would you be able to submit a ticket to our Help Desk with some details about your form and how it is setup and they can look into this.
Submit a Ticket
Thanks! - Ben
Please sign in to leave a comment.