[rt-users] Custom ticket update page not submiting values
andkulb
andrius.kulbis at gmail.com
Mon May 26 05:36:48 EDT 2014
Hello,
I'm trying to do a ticket feedback page in SelfService, for user to evaluate
the response to the ticket. I took a Update.html code from SelfService/ and
changed it to display only the fields that I need. But after clicking the
submit button, values of the customfield does not change, I get the
Display.html view, but the URL is lef the same: Feedback.html. Logs also
don't show any activity, like nothing was happening.
How to submit my data so it would update the ticket fields?
Here I create a form with 2 customfiels and comment box.
<& /SelfService/Elements/Header,
Title =>loc('Leave feedback for ticket #[_1]', $Ticket->id)
&>
<form action="Feedback.html" method="post" enctype="multipart/form-data"
name="TicketUpdate">
<input type="hidden" class="hidden"
name="Token" value="<% $ARGS{'Token'} %>" />
<input type="hidden" class="hidden"
name="id" value="<%$Ticket->Id%>" />
<input type="hidden" class="hidden" name="UpdateType" value="response"
/>
<& /Elements/ListActions, actions => \@results &>
% while ( my $CustomField = $CustomFields->Next ) {
% if(exists($FeedbackCFs->{$CustomField->Id})) {
% my @add = (NamePrefix => 'Bulk-Add-CustomField-', CustomField =>
$CustomField, Rows => 5,
% Multiple => ($CustomField->MaxValues ==1 ? 0 : 1) , Cols => 25,
% Default => $ARGS{"Add-CustomField-$CustomField->Id-Values"} ||
$ARGS{"Add-CustomField-$CustomField->Id-Value"}, );
%
% my $Values = $Ticket->CustomFieldValues( $CustomField->Id );
% my $count = $Values->Count;
<tr id="CF-<%$CustomField->id%>-ShowRow">
<input type="hidden" class="hidden"
name="Object-RT::Ticket-<%$Ticket->Id%>-CustomField-<%$CustomField->Id%>-Values-Magic"
value="1">
% }
% }
%}
% if($showComment) {
%}
<% $CustomField->Name %>: % if($count == 0) {
% if ($CustomField->Type eq 'Select') {
<& /Elements/EditCustomFieldSelect, @add &>
% } elsif ($CustomField->Type eq 'Combobox') {
<& /Elements/EditCustomFieldCombobox, @add &>
% } elsif ($CustomField->Type eq 'Freeform') {
<& /Elements/EditCustomFieldFreeform, @add &>
% } elsif ($CustomField->Type eq 'Text') {
<& /Elements/EditCustomFieldText, @add &>
% } elsif ($CustomField->Type eq 'Date') {
<& /Elements/EditCustomFieldDate, @add, Default => undef &>
% } elsif ($CustomField->Type eq 'DateTime') {
% # Pass datemanip format to prevent another tz date conversion
<& /Elements/EditCustomFieldDateTime, @add, Default => undef,
Format => 'datemanip' &>
% }
% } else {
% $showComment = 0;
% unless ( $count ) {
<&|/l&>(no value)</&>
% } elsif ( $count == 1 ) {
% $print_value->( $CustomField, $Values->First );
% } else {
<ul>
% while ( my $Value = $Values->Next ) {
<li>
% $print_value->( $CustomField, $Value );
</li>
% }
</ul>
% }
Komentaras: <& /Elements/MessageBox, Name=>"UpdateContent",
IncludeSignature => 1, %ARGS &>
<& /Elements/Submit, Label => loc('Submit feedback'), Name =>
'SubmitTicket', id => 'SubmitTicket' &>
</form>
<& /Elements/ShowHistory, Object => $Ticket, ShowHeaders =>
$ARGS{'ShowHeaders'}, DownloadableHeaders => 0 &>
Here I check for a submit button click and some do some validation.
if ( exists $ARGS{SubmitTicket} ) {
my $kokybe = $ARGS{'Bulk-Add-CustomField-102-Values'};
if($kokybe && $kokybe =~ /Puikiai/) {
$m->callback(CallbackName => 'BeforeDisplay', Ticket => \$Ticket,
ARGSRef => \%ARGS);
return $m->comp('Display.html', TicketObj => $Ticket, %ARGS);
} elsif($kokybe) {
my $atsiliepimas = $ARGS{'Bulk-Add-CustomField-103-Value'};
if($atsiliepimas && $atsiliepimas =~ /Kita/) {
my $komentaras = $ARGS{'UpdateContent'};
if($komentaras) {
$m->callback(CallbackName => 'BeforeDisplay', Ticket =>
\$Ticket, ARGSRef => \%ARGS);
return $m->comp('Display.html', TicketObj => $Ticket,
%ARGS);
} else {
push @results, loc('Fill the field "Komentaras" with your
comment');
}
} elsif($atsiliepimas) {
$m->callback(CallbackName => 'BeforeDisplay', Ticket =>
\$Ticket, ARGSRef => \%ARGS);
return $m->comp('Display.html', TicketObj => $Ticket, %ARGS);
} else {
push @results, loc('Choose appropriate value for
"Atsiliepimas"');
}
}
}
--
View this message in context: http://requesttracker.8502.n7.nabble.com/Custom-ticket-update-page-not-submiting-values-tp57496.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.
More information about the rt-users
mailing list