Community > Discussions
291 views
5 replies

Live Forms - Execute SQL and display the resulting data

Hello,

My company wishes to use the Live Forms module to create a Help Desk workflow (we have a subscription for multiple modules).  One of the requirements is for users to be able to enter a product number and, when they tab off the textbox, a SQL statement is executed using that number, then the resulting database info (e.g. product name, price, manufacturer, etc) is displayed on the form.  This allows the user to verify that the product number they wish help on is the one they intended.  The user can then enter other data on the same form and click Submit when they are done, resulting in all the data being submitted to the database via a SQL statement.

I have seen docs on executing SQL for form validation and submission but I have not seen any docs or discussions about executing a SQL statement based on user input and displaying the results and allowing the user to finish the rest of the form.  Is this possible?  If so, what documentation covers this?

Thanks for your time.

Troy

Troy Scheffel Troy Scheffel
Published 11/04/2019 22:20
Add Comment
Mandeep Singh

You can achieve this with Bind or Update a Single Field w/SQL Queryhttps://www.mandeeps.com/support/knowledgebase/live-forms-actions-on-form-view-bind-or-update-a-single-form-field-via-sql-query

However, this would require a SQL query for each field you want to populate such as Product Name, Price, Manufacturer. 

If you want to run a single query then you would need to pass the Product Number via QueryString to the page and use Bind Multiple Fields via SQL Queryhttps://www.mandeeps.com/support/knowledgebase/live-forms-actions-on-form-view-bind-multiple-form-fields-via-sql-query

replied 11/04/2019 23:50
Troy Scheffel

Thank you for the quick reply and documentation links!  The docs aren't really clear on things but they do provide a starting point at least.

Passing a value via the querystring is unfortunately not an option for our Use Case.  The value must be entered by the user on the same form, then passed to the SQL query when they tab off the textbox, then the form updated with the fields returned from the SQL query, then the user allowed to finish the form and click Submit.  As such, it does not seem that Live Forms is capable of handling this unique workflow without modifying the source code (please correct me if I am wrong).

I will check to see if we have the Enterprise/Source Code license so I can add that functionality.

Thanks.

Troy

replied 11/05/2019 14:30
Mandeep Singh

You can achieve this scenario with Bind or Update a Single Field w/SQL Query. You would just need to add multiple actions (one for each field you need to update)

replied 11/11/2019 19:52
Troy Scheffel

Thank you for the follow-up reply.  I have used your suggestion of throwing in a bunch of actions to update several Textboxes/fields via SQL queries based on one user input (textbox/field).  

I have yet to figure out how to make the textboxes that the SQL queries populate read-only (the user shouldn't be able to edit textboxes containing the SQL-generated Product name, price, manufacturer, etc). I see where you can add a CSS Class to a textbox/field but no where does it talk about where to add the actual CSS styling.  But, I am making progress!

Thanks.

Troy

replied 11/13/2019 22:02
Mandeep Singh

You can make the fields hidden so the user doesn't see them or edit them. If you need to show the data to the user then look at https://www.mandeeps.com/support/knowledgebase/live-forms-actions-on-form-view-calculated-fields

replied 11/13/2019 22:42

Last Activity 11/13/2019 22:42