TUTORIAL - Hide any New Ticket Input Field and Submit a Default Value
Commonly requested is how to remove an input field from the New Ticket form and instead submit a default value in its place. It's been explained many times already but since everyones' setup is different, it would need to again.
With this tutorial, I will attempt to explain how you could figure this out. Experience with basic HTML editing is required.
1. Set up your New Ticket form with all the desired fields including the ones you'll be hiding later. Either activate it in Setup, create it in Layout Designer, or manually with HTML. Don't worry, we'll hide it later.
2. Call up TTX in your browser and choose the New Ticket page. Are all your input fields shown? Good. Now decide which input field you're going to hide. This applies to any input field type... text box, text area, selection list, checkboxes, radio buttons.
3. With your browser still on the New Ticket page, switch to HTML source code mode. (Tip: Firefox- View Menu -> Page Source)
4. Find your input field in the HTML source code. For this example, I'll choose something that anyone would have on a stock TTX installation with no options installed. Let's remove the "Subject Line" text box.
Locate the HTML:
<input type=text size=40 name=subject value="">
This will be different depending on the field you wish to remove. This is where a good working knowledge of HTML will come in handy. You must be able to locate the HTML code for the field you're attempting to remove.
5. Now that you've seen the HTML code for the field in action on the actual page, we can write the new hidden field code. We're only figuring it out and writing it down for now... nothing to edit yet.
In our example, we only need to take the
name= attribute from our original field... nothing else.
<input type="hidden" name="subject" value="I Need Help">
The
value= attribute is what you want submitted to TTX with this hidden field. For HTML compliance, I like enclosing all attribute values with a set of quotation marks.
6. We'll have to figure out how to edit the
newticket.html template. Open this template in a plain text editor. You'll need to
remove the
field,
its label, and just to be safe,
the entire table row.
<tr>
<td align=right class=lbl>[%Subject%]<font color=red><sup>*</sup></font></td>
<td align=left><input type=text size=40 name=subject value="(%INPUT_subject%)"></td>
</tr>
7. Now we need to insert the hidden input field we wrote before. It must be contained between the <form> tags named newticket. So find this line, and add your new hidden input field immediately below it.
<form method=post action="(%ENV_SCRIPT_NAME%)" name=newticket enctype="multipart/form-data" onsubmit="return onlyonce()">
<input type="hidden" name="subject" value="I Need Help">
That's it... your field is hidden from your customers and the correct value is always submitted to all new tickets. In this example, there is no "subject" field on the form and all new tickets will have the same subject, "I Need Help".
Next post in this thread is more advanced. I'll explain what to do if you're removing a field that is already part of a larger macro.