TicketObj->Id to string for html

I’m trying to grab just the current ticket ID, for a print button above the ticket summary on the Display.html screen. I want this so that when the user clicks on the print button, it actually prints
/History.html?id=.

Either my Google is broken because I am not finding how to extract the last 5 characters of the URL, and / or I am having trouble putting the value of $TicketObj->Id as a string value. This is not a scrip, but rather a Callback. Any help is greatly appreciated.

Sincerely,
Izz

Izz Abdullah
Network Administrator
Hibbett Sporting Goods

Sorry: RT 4.0.2From: Izz Abdullah
Sent: Monday, March 12, 2012 9:57 AM
To: rt-users@lists.bestpractical.com
Subject: TicketObj->Id to string for html

I’m trying to grab just the current ticket ID, for a print button above the ticket summary on the Display.html screen. I want this so that when the user clicks on the print button, it actually prints
/History.html?id=.

Either my Google is broken because I am not finding how to extract the last 5 characters of the URL, and / or I am having trouble putting the value of $TicketObj->Id as a string value. This is not a scrip, but rather a Callback. Any help is greatly appreciated.

Sincerely,
Izz

Izz Abdullah
Network Administrator
Hibbett Sporting Goods

I’m trying to grab just the current ticket ID, for a print button above
the ticket summary on the Display.html screen. I want this so that when
the user clicks on the print button, it actually prints

/History.html?id=.

Either my Google is broken because I am not finding how to extract the
last 5 characters of the URL, and / or I am having trouble putting the
value of $TicketObj->Id as a string value. This is not a scrip, but
rather a Callback. Any help is greatly appreciated.

You should really show what you’re trying, since otherwise no one can
point to where you’ve gone wrong.

I suspect you just want <% $TicketObj->Id %>

<a href=“https://ourRT/Ticket/History.html?id=”.$id onClick=“window.print();return false”>Print Ticket Summary
This is being displayed on the Display.html page. I am simply wanting to print, from the Display.html page, the corresponding History.html page.

Above this I had set $id = $TicketObj->id;
This does not play well in the print dialog, nothing is passed into the $id (at least as a string).-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Thomas Sibley
Sent: Monday, March 12, 2012 10:08 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] TicketObj->Id to string for html

On 03/12/2012 10:56 AM, Izz Abdullah wrote:

I’m trying to grab just the current ticket ID, for a print button
above the ticket summary on the Display.html screen. I want this so
that when the user clicks on the print button, it actually prints

/History.html?id=.

Either my Google is broken because I am not finding how to extract the
last 5 characters of the URL, and / or I am having trouble putting the
value of $TicketObj->Id as a string value. This is not a scrip, but
rather a Callback. Any help is greatly appreciated.

You should really show what you’re trying, since otherwise no one can point to where you’ve gone wrong.

I suspect you just want <% $TicketObj->Id %>

<a href=“https://ourRT/Ticket/History.html?id=”.$id
onClick=“window.print();return false”>Print Ticket Summary

Mason isn’t all Perl. <a href=“some string”.$id makes no sense in
Mason. Refer to http://masonbook.com

Print Ticket Summary

This is being displayed on the Display.html page. I am simply
wanting to print, from the Display.html page, the corresponding
History.html page.

Your onclick handler “window.print(); return false” is going to open the
print dialog for the page it’s on (i.e. Display.html).

Ok, understood. Short of buying a Mason book, I can rewrite some javascript to work out the print, but I am still not able to convert TicketObj->id to a string. Can you assist there please?From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Thomas Sibley
Sent: Monday, March 12, 2012 10:39 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] TicketObj->Id to string for html

<a href=“https://ourRT/Ticket/History.html?id=”.$id
onClick=“window.print();return false”>Print Ticket Summary

Mason isn’t all Perl. <a href=“some string”.$id makes no sense in Mason. Refer to http://masonbook.com

Print Ticket Summary

This is being displayed on the Display.html page. I am simply wanting
to print, from the Display.html page, the corresponding History.html
page.

Your onclick handler “window.print(); return false” is going to open the print dialog for the page it’s on (i.e. Display.html).

Ok, understood. Short of buying a Mason book,

You don’t have to buy the book, click on “Read it online”.
Also, Tom provided an example of the correct syntax.

-kevin

I completely overlooked his example. Thanks…From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin Falcone
Sent: Monday, March 12, 2012 11:02 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] TicketObj->Id to string for html

Ok, understood. Short of buying a Mason book,

You don’t have to buy the book, click on “Read it online”.
Also, Tom provided an example of the correct syntax.

-kevin

I can rewrite some javascript to work out the print, but I am still not able to convert TicketObj->id to a string. Can you assist there please?

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Thomas
Sibley
Sent: Monday, March 12, 2012 10:39 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] TicketObj->Id to string for html

<a href=“https://ourRT/Ticket/History.html?id=”.$id
onClick=“window.print();return false”>Print Ticket Summary

Mason isn’t all Perl. <a href=“some string”.$id makes no sense in
Mason. Refer to http://masonbook.com

Print Ticket Summary

This is being displayed on the Display.html page. I am simply
wanting to print, from the Display.html page, the corresponding
History.html page.

Your onclick handler “window.print(); return false” is going to open the print dialog for the page it’s on (i.e. Display.html).

Ok, understood. Short of buying a Mason book, I can rewrite some
javascript to work out the print, but I am still not able to convert
TicketObj->id to a string. Can you assist there please?

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:
rt-users-bounces@lists.bestpractical.com] On Behalf Of Thomas Sibley
Sent: Monday, March 12, 2012 10:39 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] TicketObj->Id to string for html

<a href=“https://ourRT/Ticket/History.html?id=”.$id
onClick=“window.print();return false”>Print Ticket Summary

Mason isn’t all Perl. <a href=“some string”.$id makes no sense in Mason.
Refer to http://masonbook.com

Print Ticket Summary

This is being displayed on the Display.html page. I am simply wanting
to print, from the Display.html page, the corresponding History.html
page.

Your onclick handler “window.print(); return false” is going to open the
print dialog for the page it’s on (i.e. Display.html).

As Tom pointed out below:

<a href="https://ourRT/Ticket/History.html?id=https://ourrt/Ticket/History.html?id=
".$id
Is invalid Mason.

When you want to add the value os one of your Perl variables to the output
that you’re generating [and that’s really the whole point of Mason, isn’t
it? ],
you need to use the Mason Tag Syntax and set your access to Perl variables
between a <% %> pair of tag symbols. So, as Tom also pointed out, your
code above needs to look like this code:

<a href=“https://ourRT/Ticket/History.html?id=https://ourrt/Ticket/History.html?id=<%
$id %>”

As for buying the book, there is a “read it online” link in the box on the
right side, which will take you to an online HTML version of the book that
you can use for reference at http://masonbook.com/book/

Len.

lenjaffe@jaffesystems.com 614-404-4214
Proprietor: http://www.theycomewithcheese.com/ - An Homage to Fromage
Grubmaster: Greenbar http://www.greenbartraining.org/ 2011, 2010, 2009,
Grub Asst. 2008, Trained 2007.