Help Desk Software & Beyond
May 22, 2012, 01:16:09 AM *
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] Disable Cookie for Only Certain Layout Designer Fields  (Read 1837 times)
rozwellite
Newbie
*

Karma: 2
Posts: 43



View Profile
« on: June 09, 2008, 02:09:02 PM »

I do not want to disable cookies for all the custom fields. I have two fields that are always changing and because people do not have to manually update them we are getting incorrect data. They are my Category field and Department field. Below is a sample of the HTML code I am using. If someone could please tell me either how to make the default blank or to disable the cookie for this code. Thanks.

<tr><td align="right" class="lbl">Category<font color="red"><sup>*</sup></font></td>
<td align="left">(%CUSTOM3%)
<input type="hidden" name="mandatory" value="xCategory">


Edit by Sparky:  Topic title
« Last Edit: June 10, 2008, 03:43:03 PM by sparky672 » Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #1 on: June 09, 2008, 02:20:55 PM »

You simply have to replace each macro, (%CUSTOMx%), with its corresponding HTML code.  Since the cookie is read by TTX while it constructs the code for the macros, you will be bypassing the cookie's value by NOT using the individual macro.

This thread shows an example for a pull-down list...

http://forum.unitedwebcoders.com/index.php/topic,721.0.html

« Last Edit: June 09, 2008, 02:44:15 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
rozwellite
Newbie
*

Karma: 2
Posts: 43



View Profile
« Reply #2 on: June 09, 2008, 03:01:47 PM »

I looked at the post from above and it appears that it is for setting to a default value. In my case I do not have a default value. I need it to be empty. Also I have to change the drop down options available quite often to add new values or update old values. If I did the second option in the prior post every time I made a change to the list which right now is over 30 values I would have to update it in the newticket.html. So unless I missed something I don't think that will work for me. So my question is.... Is there another way to set the option to blank?
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #3 on: June 09, 2008, 04:06:43 PM »

Quote from: rozwellite
I looked at the post from above and it appears that it is for setting to a default value. In my case I do not have a default value. I need it to be empty.

Yes you do... your default value is blank.

...so you just make the first option "selected" and value is blank...

<option value="" selected></option>
<option value="item1">item 1</option>
<option value="item2">item 2</option>
<option value="item3">item 3</option>

Quote from: rozwellite
Also I have to change the drop down options available quite often to add new values or update old values. If I did the second option in the prior post every time I made a change to the list which right now is over 30 values I would have to update it in the newticket.html.

Editing the html template is the easiest way to achieve what you've requested.

If you'd rather modify how the cookie is written, the Perl code for the cookie is contained in the subroutine preparecookie at the end of ttx.cgi
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #4 on: June 10, 2008, 03:37:41 PM »

ALTERNATE SOLUTION:

Verified and tested as working (version 2.24).

To disable the saving of a particular field in the cookie...

In ttx.cgi around line #714 in the preparecookie subroutine...

Find this...

Quote
next if $value eq undef;

Replace with this...

Quote
next if (($value eq undef) || ($name eq "newticket_xCategory"));

Where newticket is the name of the form, usually "newticket"...

and Category is the name of the custom field whose value you do NOT want saved in the cookie.

Separate those with an underscore and precede the custom field name with a lower-case "x".
« Last Edit: June 10, 2008, 07:38:02 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
rozwellite
Newbie
*

Karma: 2
Posts: 43



View Profile
« Reply #5 on: June 10, 2008, 10:35:19 PM »

I have two custom fields that I need to disable the cookies for. I used the following code and it seems to be working. Thank you so much that makes my life a lot easier.

Code:
next if (($value eq undef) || ($name eq "newticket_xCategory") || ($name eq "newticket_xCc:"));

Again thank you for finding this solution.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #6 on: June 10, 2008, 10:37:25 PM »

Your code looks fine.

You're welcome.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
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.025 seconds with 19 queries.