Because you only want them to enter the ticket number, but want to manipulate it and display it as a link, the only way to do this is going to be by storing it as a link. This includes using a Website field type because that field type automatically hyperlinks URL's when displaying them in the entry detail and {all_fields} merge tag output in notifications.
You can still capture the data using a Single Input field or a Number field, depending on how you are doing it now. But you'd then have to implement a customization to take this value and populate a Website field with it, adding the http://helpdesk.com/ticketID= in front of it to create the full URL.
You would do this by...
- Edit your form
- Add a Website field to your form
- Edit the Website Field and give it a field label of "Ticket Link" or whatever you want to call it
- Select the Advanced tab
- Set the field so that it's visibility is Admin Only
- Save your form
Now the hard part. You need to write custom code so that when the form is submitted, the value of the ticket input field is concatenated with the http:// URL you want to form the link and stored as the value of the Website field you created above.
To do this you would use the gform_pre_submission hook which is documented here:
http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter
You would write custom code that uses this hook. You would place this custom code in your themes functions.php file OR create your own custom plugin and activate it (ideal but more advanced).
Your hook would need to get the value of the ticket number field, then concatenate it with the static link URL you need to place in front of it to form the correct link and then store it as the value for the Ticket Link field.
Here is a forum post that discusses how to combine the value of fields and store that combined value as the value of another field:
http://www.gravityhelp.com/forums/topic/combining-fields#post-5397
That example is very similar to what you want to do.
Posted 13 years ago on Wednesday November 30, 2011 |
Permalink