Getting multiple fields with SQL Request and JavaScript

Blog Post created by redpanda on Feb 27, 2018

So, you want to save more than one field from a database query but you don't want to have multiple SQL Request controls in your form?  You can achieve this with a customized SQL query and JavaScript.


In the query, concatenate the fields you want to use.  In this example, a pipe character ( | ) is used as a delimiter.  Set the Value field to your concatenated fields ("Details") and the Display field to a reader-friendly field for your users to select.

SQL Request action

Set the JavaScript variable name for your SQL Request control as well as the other fields you want to populate:

JavaScript Variable Name

Use the Custom JavaScript area in the Form Settings to retrieve the fields.  In this example, the SQL Request control is displayed as a Drop Down List, so the JavaScript uses the Change event to get the values and then populates the textboxes with the fields from the database query.

Form Settings Custom JavaScript