send survey results to database

mbuitenkamp-4316
Community Member Posts: 15 ☆ Roadie ☆
Hi,
I really hope someone can help me:
I have a survey with quite a number of variables that I want to send to a mySQL database.
All I can find is that I apparently need to use a custom script and use POST, but to me, that's hocus pocus.
Can anyone help me get all my variables into my database?
Here's a few of my variables:
var_Name
var_DOB
var_City
Thanks in advance x
I really hope someone can help me:
I have a survey with quite a number of variables that I want to send to a mySQL database.
All I can find is that I apparently need to use a custom script and use POST, but to me, that's hocus pocus.
Can anyone help me get all my variables into my database?
Here's a few of my variables:
var_Name
var_DOB
var_City
Thanks in advance x
Answers
-
wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 630 eLearning ROCKSTAR Admin TeamHi @mbuitenkamp-4316
From the Lectora side it is pretty straight forward.
Here are two options:
Insert a form.- Insert a Lectora Form object from the Test & Survey ribbon.
- In the Form properties select Submit Form, Custom Script, then add the URL where the form should be posted to.
- Insert Entry Fields, also on the T&S Ribbon, into the Form.
- Name the entry fields in the Project Explorer so they match what the server expects.
- Set the entry field variables to your variables.
- Add an Action either on show, or on click of a button, with an action of Submit Form for this form.
Your other option is to use Lectora's built in jQuery object triv$ to submit your variables.
For this method just create an Action that has the action Run JavaScript and add the following code (modified for your purposes):triv$.post('https://server.com/url-for-the-post', { 'name' : Varvar_Name.getValue(), 'dob' : Varvar_DOB.getValue(), 'city' : Varvar_City.getValue() } );
The parameters consist of the parameter name expected on the server such as 'name' and then the value of your variable. The JavaScript name of the variable is your variable name var_Name prefixed with Var. The getValue function returns the current value to send to the server.
For the server side you might consider hiring a contractor on Upwork or a similar site.
Another option might be to sign up for Airtable and build your database, it's fairly simple point and click. Then after you have created it they give you an API that you could modify and call easily with the second method above (Run JavaScript).
Here is an example for posting data to Airtable, and I'm sure a little searching can find better ones. Use the getValue() method above to get the values from your variables..
- Insert a Lectora Form object from the Test & Survey ribbon.
Categories
- 4.7K All Categories
- 3 New Feature Releases
- The Training Arcade®
- Arcades™
- 57 ✫ Announcements
- 6 ✪ Contests
- 34.1K eLearning Brothers® Products
- 33.6K Lectora®
- 31.6K Lectora Discussions
- 1.9K Lectora Feature Requests
- 64 Lectora User Groups
- 16 Asset Library
- 10 AssetLibrary Discussions
- 6 AssetLibrary Feature Requests
- 290 CenarioVR®
- 169 CenarioVR Discussions
- 121 CenarioVR Feature Requests
- 29 Rockstar Learning Platform®
- 20 Rockstar Learning Platform Discussions
- 9 Rockstar Learning Platform Feature Requests
- 4 Off-the-Shelf Course Library
- 3 Off-the-Shelf Course Library Discussions
- 1 Off-the-Shelf Course Library Feature Requests
- 114 CourseMill®
- 107 CourseMill Discussions
- 43 ReviewLink®
- 31 ReviewLink Discussions
- 12 ReviewLink Suggestions
- 2 The Training Arcade®
- 1 The Training Arcade Discussions
- 1 The Training Arcade Feature Requests
- 10 Additional Learning Products
- 2 Adobe®
- 4 Articulate®
- 2 Camtasia®
- Docebo®
- 1 iSpring®
- 1 Microsoft® PowerPoint®
- 911 All Things eLearning
- 5 Course Development Showcase
- 1 eLearning Brothers® Downloads
- 1 Compliance Training
- 10 eLearning Development
- eLearning Game Design
- 7 Instructional Design
- 546 Learning Management System (LMS) Integration
- 2 Mobile Learning
- 5 Visual Design
- 328 Web Accessibility
- 1.2K ♪ The Green Room
- 7 ♡ Community Feedback
- 7 Community Tips