PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to hyperlink field value

  1. sYpram
    Member

    Hello,

    I want some help and instructions on setting up a form. We built a form where we would type in a ticket number. I wanted to check if it was possible to hyperlink the ticket number to embedded link (example: http://helpdesk.com/ticketID=####). The #### is where the ticket number would be placed and then direct to that link.

    Please advise.

    Posted 12 years ago on Wednesday November 30, 2011 | Permalink
  2. So what you want to do is have a field where a user enters a ticket number. Then you want to present this ticket number as a link?

    Where do you want to do this?

    - Do you want this to happen in the entry details?
    - Do you want this to happen in the confirmation page and the email notifications?
    - Both? Or are you flexible, if so which one is most important?

    This will determine what you need to do to implement this. Let me know and we can provide some guidance on how to accomplish this.

    Posted 12 years ago on Wednesday November 30, 2011 | Permalink
  3. sYpram
    Member

    Hello Carl,

    I want to link it in the entry form. So when the ticket number is inserted the agent can just click and it open a new browser page redirect the agent to ticket on the helpdesk.

    And i like you suggestion to reference it on the confirmation email... this would be a good idea if we can implement.

    http://maxupload.net/images/86489346242536770276.jpg

    Posted 12 years ago on Wednesday November 30, 2011 | Permalink
  4. 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 12 years ago on Wednesday November 30, 2011 | Permalink