Programmatically Pre-filling Ticket Submission Form Fields
You can programmatically pre-fill form fields on a ticket submission page using URL parameters, with form field names as parameter names and pre-fill data as values, or PHP POST requests.
Example Use Case:
Imagine you want to add an "Ask a Question" link linked with a Guest Support form to your product page, allowing users to submit inquiries directly through a ticket. In this scenario, you aim to pre-fill the subject field with the product name. Now, this feature will assist you in achieving that seamlessly.
Follow these simple instructions to learn how to effortlessly pre-fill your form fields.
Get Field Names:
To pre-fill input fields, you need to identify the field name, which you can obtain by following these steps:
- Login to Joomla! Administrator
- Click on Components -> Guest Support -> Forms
- From the list of forms, click on the name of the form you wish to pre-fill.
Alternatively, you can select the form and then click on ... Actions -> Edit - Now you can see the field name under each field. Refer to the screenshot below for reference:
Pre-fill Input Fields Using URL Parameters:
Example with SEF URL:
https://YOUR_WEBSITE/TICKET_SUBMISSION_PAGE_URL/?name=Jane Doe&email=EMAIL_ADDRESS&subject=Product Enquiry
Example with Non-SEF URL:
https://YOUR_WEBSITE/TICKET_SUBMISSION_PAGE_URL/index.php?option=com_guestsupport&view=createticket&id=1&name=Jane Doe&email=EMAIL_ADDRESS&subject=Product Enquiry
Explanation:
- https://YOUR_WEBSITE/TICKET_SUBMISSION_PAGE_URL/: This is the full URL where you can access the ticket submission page for the specific ticket submission form, for example: https://www.rcatheme.com/contact-support.
- id=1: This represents the form ID. Replace 1 with the form ID.
- name=Jane Doe: Here, 'name' is the input field name, and 'Jane Doe' is the full name of the user submitting the form. You can use this to pre-fill the user's name when they are logged in.
- email=EMAIL_ADDRESS: Here, 'email' is the input field name, and 'EMAIL_ADDRESS' is the user's email who is submitting the form. You can use this to pre-fill the user's email address when they are logged in.
- subject=Product Enquiry: Here, 'subject' is the input field name, and 'Product Enquiry' is the subject of this ticket.
Pre-fill Input Fields Using PHP POST:
You can pre-fill input fields using PHP POST requests by using the field names as parameter names.