What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Autopopulate Name and Email fields based on personal log in system.Asked by federmora on December 16, 2016 at 01:04 AM
I embedded the form on the Joomla website following these instructions
As we have a log in system to our website woudl it be possible to auto-populate the fields
Name and the field Email, based on the person's log in database?
Based from your requirements, unfortunately, it is not yet possible to import data from the database and auto populate to the form. But the possible work to do, is to import the data from the forms submission data either from CSV or Excel and combine them with JotForm submission data. You can check the Import Data App.
Next thing to do is to prepopulate the fields in your form. Please check the Field Prepopulator App or using the prepopulating the fields using URL parameters, please read this guide: Prepopulating fields to your JotForm via URL parameters.
If you need further assistance, please let us know.
Thank you very much.
When customising the URL for each user where do I see the exact code I need to use for a specific field?
For example I see that the field "name" is as follow:
but I cannot figure out how the "E-mail" field looks like
for example this code below does not work, the email field is not being populated
You can follow our guide here on How to find field IDs and names. For example, in the email, since the name is email11, you can use the code email@example.com in the url to automatically fill that email field.
You only need to use brackets if referring to a field with multiple input such as the Full Name field or the Date field. With the full name field, you can set the name of the field and add [first] or [last] to indicate whether you want to fill up the first or last name. As in your example, the name of the Full Name field is "name" and we have a "first" to fill the first name with John and "last" inside brackets to fill up the last name Smith. name[first]=John&name[last]=Smith
Please let us know if you need further assistance.
Very clear thank you!
Having embedded the form on our website, and wanting to populate the fields of name and email of every user then we will have as many customized URLs as there are users right? and we would have to give every user their personal link to the form right?
So basically it would be
Link for USER1 John Smith
Link for USER2 Ann Smith
and we would have to find the way to make available the right link for every user.
Any tip you can share on how to best do it?
Let me see if I understand properly the concern: You are using Joomla and you have embedded JotForm in it, you require users to be logged in and by this, the moment the logged in user would like to visit the page with the form, you want the name and email to populate the form fields, is this correct? If so, you might not need to create custom links for each user. Here's one method I could give you, but this requires some PHP programming:
First you will need to use text editors such as Jumi or Sourcerer to be able to use PHP in your article where you have placed your form.
Next: To be able to set and use the session username variable in Joomla, you will need to use this code in your Joomla page:
$user =& JFactory::getUser();
And this is the variable to call the username:
Your complete code:
$user =& JFactory::getUser();
To be able to get all the information on the session of a logged in user, you might want to print the data in order to get all the references like this:
Just by visiting the page where this code is, you will see lots of data to print on the information of the user such as the name, username, email address, etc.
Once you are able to get the proper variables, you can then make use the prepopulation method as mentioned by Chriistian, or you can just assign it directly on your embed code. Example:
And this should prepopulate the field of your form in your joomla page with the email address of the logged in user.
Hope this gives an idea on how to use PHP variables to prepopulate your form in your Joomla page. What I'm not sure about on Joomla is if the first name and last name are separate, if they are together, we might need to create additional codes to parse and split the full name string from Joomla.
If you have questions, please let us know.