TYPOlight tutorials
Table of Contents
Automatically fill out forms for members
No one likes to fill out online forms. Help your members by automatically filling out forms for them. How? By utilizing TYPOlight's powerful built in tags, of course.
This tip uses TYPOlight's built-in tags. Find out more about them here: Insert Tags
Things you should know
- What information you require in your member registration form (e.g. First name, last name, email, etc.)
- How to create a custom form in TYPOlight.
Creating your form
You can use this trick on any form you want. For this example we will create a contact form. Create your form by adding the fields you wish the user to fill out. For this example we will make six fields:
- First name
- Last name
- Company name
- Email Address
- Message
- Security question
Give each form your desired field name. It's usually good to give them a field name that is similar to their field label. E.g. the field that you want people to put their first names in, should have the field name "first_name" and a field label "First name". This makes it easier to organize and recognize each field.
Once you have created each field and given them each an appropriate field name and label, save the form.
Inserting the tags
TYPOlight has built in "insert tags" that will automatically be replaced by certain information. In this case we are going to use the `{{user::property}}` tags.
Go to your form that you have created, and click to edit the "First name" field. Once editing the field, scroll down to the option "Field value" and in the blank field insert this tag: {{user::firstname}}. This will automatically populate the field with the member or user's first name.
Do this for all the applicable fields:
| Field | Insert tag |
|---|---|
| First name | {{user::firstname}} |
| Last name | {{user::lastname}} |
| Company | {{user::company}} |
| {{user::email}} |
The {{user::property}} insert tags only work if the user has provided that information through the registration module or the personal data module, and the user or member is logged in. If the user is not logged in, the text fields will simply be blank.
Now when a member is logged in, the contact form will already have their first and last names, their company, and their email address filled in. The only thing left for them to fill in is their message and the security question.
Just one more way TYPOlight helps you give people the best experience on your website.
Tutorial created by Logan