Source URL: https://docs.surveycto.com/03-collecting-data/02-web-data-collection/03.custom-urls.html
Last updated: 2024-03-27
Using custom links to pass information into forms
If you retrieve a sharable web link for one of your forms (click Share in the Web data collection section of the Collect tab), you will notice that the URL ends with a funny-looking (but suggestive) string: ?caseid=. When sending links to people, you can append something unique to that URL, so that it ends more like ?caseid=A234C2 or ?caseid=John+Doe.
If you use case management, you can simply append a unique case ID to the URL in order to pass that case ID into the form. Even if you are not using case management, you can use this ability to pass basically anything into your form; just be careful about which characters you append since not all characters are allowed in URLs: letters, numbers, and underscores are safe, you should include a + instead of a space (as in the "John+Doe" in the example above), and other special characters can only be included if encoded carefully.
If you do include something added onto the URL you share with users, you can pull that something into your form by adding a field with the caseid field type: this field will be invisible to the user, but it will automatically contain any case ID that was passed into the form (either via the regular case management user interface, or by virtue of a user using a URL that includes something added to the end). And actually, new forms begun with SurveyCTO automatically include such a field, just in case you're using case management; in the online form designer, you can check to make sure that it's included as a meta-data field in the Form settings. If you add "A234C2" to the end of the URL you share with somebody, for example, and the user uses that URL to fill out your form, then "A234C2" would populate the form's caseid field (under whatever name you gave to that field). You can then show that field to the user or, perhaps, use it to load data from a pre-loaded .csv file.