Help Desk Software & Beyond
May 21, 2012, 10:42:45 PM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [MOD] Implementing TTX ticket forms in other web applications  (Read 2359 times)
Magnus Wester
Full Member
***

Karma: 2
Posts: 116



View Profile WWW
« on: December 09, 2006, 10:34:00 AM »

I have inserted a TTX "new ticket" form into the contact page of one of my web sites. One of the problems I had was that after you submit a ticket with newticket.html, TTX always displays the confirmnew.html confirmation page which is part of the TTX application. After submitting an inquiry, the user is in fact deep inside TTX, without any simple means to return to the website he came from.

I solved this by implementing a simple redirect to a user-specified confirmation page within the calling web site.

First I created a "new ticket" form that could be "included" into existing pages in my website. My site is written in PHP so I can include just about anything with "include" or "require" statements. There are many other ways to do this depending on how your website is designed - you can even do it with a FrontPage component.

To create my "phpticket.html" I removed some of the items from the default "newticket.html" file in TTX, e.g the background color and the preview function. I also tailored the form design to the layout of my site.

Then I added a hidden form field to the phpticket form that records the URL that the website wants to return to after the ticket has been submitted:
<input type=hidden name=confirm value=(%INPUT_confirm%)>

One of the many clever things with TTX is that the %INPUT parameters can be set from the URL, so I could easily set the "confirm" parameter when I included the phpticket form in my web page:
require "http://domain.tld/cgi-bin/ttx.cgi?cmd=newticket&form=phpticket&noheader=true&confirm=domain.tld/confirm-ticket.php"

As you may have noted, TTXTicket.pm neatly saves both the name and e-mail address from every new ticket in a cookie, and re-uses these when you submit your next ticket. Adding the "confirm" field to the cookie required a very small change to TTXTicket.pm.

To complete the solution to my problem, I modified the loadtemplate section in TTX.cgi to check if we're heading towards the default confirmnew.html confirmation page, and redirect the browser to the user-specified confirmation page instead (if there is one).


When users want to contact me, they go to the contact page of my website. They fill in the fields of the contact form and press submit. TTX grabs the form and stores it in the ticket database. It then redirects the browser to the confirmation page on my own website. From there, the user can do whatever he wants.


Alex, please consider adding this kind of functionality to a future version of TTX as it is basically impossible to integrate TTX with existing web applications the way it is designed today. On the other hand, the sleek design of TTX makes it very simple to implement the small changes required to make TTX a nice little modular web component that can be used just about anywhere.
« Last Edit: January 18, 2008, 03:46:40 PM by sparky672 » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.018 seconds with 18 queries.