Checking the current category on a button

Hi

In the Edit ticket screen I've tried to change the Ok button to check the category.

But the variable is showing "1" no matter what category I choose on the ticket. (log("Kategori " + category + "\n");)

I use this to get the value for the category:

Ticket t;
t.load(ticketId);

String category = "";
category = t.getValue("category");

(The purpose is to exclude som extra fields from validation on some categories)

Any ideas?

RE: Checking the current category on a button

Hi, your method will get the current value of the ticket and not from the field category.

Try use something like

String category = getHtmlElement("category").toString();

and then validate this value.

By: Gustaf Cullin 25 Apr 2017

RE: Checking the current category on a button

Hi

Thanks for your answer.

I ended whis this (before I saw your answer):

String category = getCgiVariable("category");

It seems like it works as aspected.

By: Ingar Karlsen 25 Apr 2017