Stop form submit on ticket reply

Hi,

I need to be able to stop submitting a “Public Reply” correspondence
based on a evaluation that returns a Boolean value.

This decision must be taken when the user clicks the “Update Ticket” button

Everything I have tried fails because the form is always submitted.

Any help will be highly appreciated

Regards,

Hugo Escobar

http://www.associationfinancialservices.com/

4770 Biscayne Blvd, Ste 700
Miami, FL 33137

main: 305.677.0022
support: 305.921.4620
email: hescobar@afslc.com

Follow us on Facebook and Linked-In
http://www.facebook.com/pages/Miami-FL/ASSOCIATION-FINANCIAL/64952991864
http://www.linkedin.com/companies/1006276

NOTICE: This email and any attachment to this email may contain
confidential information. If you are not the intended recipient, you must
not review, retransmit, convert to hard copy, photocopy, use or disseminate
this email or any attachments to it. If you have received this email in
error, please notify us immediately by return email and delete this
message. Please note that if this email contains a forwarded message or is
a reply to a prior message, some or all of the contents of this message or
any attachments may not have been produced by our firm. As our firm may be
deemed a debt collector, if your payment is in default, we may be
attempting to collect a debt on behalf of the association, and any
information obtained may be used for that purpose.

Le 23/08/2016 � 22:59, Hugo Escobar a �crit :

Hi,

I need to be able to stop submitting a “Public Reply” correspondence
based on a evaluation that returns a Boolean value.

This decision must be taken when the user clicks the “Update Ticket” button

Everything I have tried fails because the form is always submitted.

Any help will be highly appreciated

create a file named
…/rt/local/html/Callbacks/YourOrg/Ticket/Update.html/BeforeUpdate

with a content such as:

<%init>

if ( exists $ARGSRef->{SubmitTicket} ) {
# Write here your evaluation, you can use submitted values in
%$ARGSRef and the ticket object $TicketObj
if ( !$evaluation ) {
push @$results, loc(“Message that should be displayed to user”);
$$skip_update = 1;
}
}
</%init>
<%args>
$TicketObj => undef
$skip_update => undef
$results => undef
$ARGSRef => undef
</%args>

don’t forget to cleanup your mason cache and restart your webserver.

Thanks Emmanuel for your response.

My initial post was a little inaccurate, I forgot to mention some details:

  1. The user wants to add a ticket reply
  2. The user writes (and prepares her message, attachments, etc)
  3. The user presses the “Update Ticket”, some condition is evaluated two
    possible outcomes (true, false)
    3.1 If false => submit reply
    3.2 If true => the user is asked if the reply should be submitted
    3.2.1 User wants to continue => reply submitted
    3.2.2 User decides to abort reply submission => no ticket reply should be
    added

I tried to implement something in javascript to handle “3.2.2” but the
reply is always submitted

I’m thinking now in a variation of your proposed solution. Perhaps bouncing
the ticket reply including an ‘onload’
javascript alert for steps 3.2.1 of 3.2.2On Tue, Aug 23, 2016 at 6:22 PM, Emmanuel Lacour elacour@easter-eggs.com wrote:

Le 23/08/2016 à 22:59, Hugo Escobar a écrit :

Hi,

I need to be able to stop submitting a “Public Reply” correspondence
based on a evaluation that returns a Boolean value.

This decision must be taken when the user clicks the “Update Ticket”
button

Everything I have tried fails because the form is always submitted.

Any help will be highly appreciated

create a file named
…/rt/local/html/Callbacks/YourOrg/Ticket/Update.html/BeforeUpdate

with a content such as:

<%init>

if ( exists $ARGSRef->{SubmitTicket} ) {
# Write here your evaluation, you can use submitted values in
%$ARGSRef and the ticket object $TicketObj
if ( !$evaluation ) {
push @$results, loc(“Message that should be displayed to
user”);
$$skip_update = 1;
}
}
</%init>
<%args>
$TicketObj => undef
$skip_update => undef
$results => undef
$ARGSRef => undef
</%args>

don’t forget to cleanup your mason cache and restart your webserver.

RT 4.4 and RTIR training sessions, and a new workshop day!
https://bestpractical.com/training

  • Boston - October 24-26
  • Los Angeles - Q1 2017

Regards,

Hugo Escobar

http://www.associationfinancialservices.com/

4770 Biscayne Blvd, Ste 700
Miami, FL 33137

main: 305.677.0022
support: 305.921.4620
email: hescobar@afslc.com

Follow us on Facebook and Linked-In
http://www.facebook.com/pages/Miami-FL/ASSOCIATION-FINANCIAL/64952991864
http://www.linkedin.com/companies/1006276

NOTICE: This email and any attachment to this email may contain
confidential information. If you are not the intended recipient, you must
not review, retransmit, convert to hard copy, photocopy, use or disseminate
this email or any attachments to it. If you have received this email in
error, please notify us immediately by return email and delete this
message. Please note that if this email contains a forwarded message or is
a reply to a prior message, some or all of the contents of this message or
any attachments may not have been produced by our firm. As our firm may be
deemed a debt collector, if your payment is in default, we may be
attempting to collect a debt on behalf of the association, and any
information obtained may be used for that purpose.

Thanks Emmanuel for your response.

My initial post was a little inaccurate, I forgot to mention some details:

  1. The user wants to add a ticket reply
  2. The user writes (and prepares her message, attachments, etc)
  3. The user presses the “Update Ticket”, some condition is evaluated
    two possible outcomes (true, false)
    3.1 If false => submit reply

ok

3.2 If true => the user is asked if the reply should be submitted

use another callback in the same Update.html page to display a
confirmation button

3.2.1 User wants to continue => reply submitted

in you’re first callback, get the submit value from $ARGSRef that say
the confirm button has been pressed.

3.2.2 User decides to abort reply submission => no ticket reply should
be added

the same, with a “Discard” button, you catch the value from $ARGSRef and
then use MaybeRedirectForResults to Display.html after emptying submited
values from $ARGSRef.

I tried to implement something in javascript to handle “3.2.2” but the
reply is always submitted

no need for JS here, thought you can of course do this using only js :wink: