Enable warning popup before submitting form?

Moderator: crythias

Locked
crynof
Znuny newbie
Posts: 24
Joined: 20 Mar 2020, 20:23
Znuny Version: 6.0
Real Name: Camilo

Enable warning popup before submitting form?

Post by crynof »

Hi!

Currently I have my customer form (customer.pl) working perfectly, but due to a new functionality that I implement I need to assign a validation when submitting the form.

My form has the option to choose the priority enabled. The problem is that users choose priority number 5 for any reason, that is why I need to show a popup when the form is sent warning that the user has chosen level 5 priority and if he is sure to continue.

How can I enable a confirmation popup?

Many thanks
Cheers
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Enable warning popup before submitting form?

Post by zzz »

Hey,

You'll need to create a new JavaScript file for the customer interface and write a couple of lines.
Let me know if you need more help.

Best regards
Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
crynof
Znuny newbie
Posts: 24
Joined: 20 Mar 2020, 20:23
Znuny Version: 6.0
Real Name: Camilo

Re: Enable warning popup before submitting form?

Post by crynof »

zzz wrote: 05 May 2020, 19:42 Hey,

You'll need to create a new JavaScript file for the customer interface and write a couple of lines.
Let me know if you need more help.

Best regards
Emin
Many thanks zzz :D , yes i need some help because i never implemented javascript in OTRS, and for this reason i dont know how to integrate with functions as submit button.

I need create a js file and then include into CutomerTicketMessage.tt?

Where can i found examples?.

Cheers
skullz
Znuny superhero
Posts: 658
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Enable warning popup before submitting form?

Post by skullz »

not soo clean way..direct javascript on CustomerTicketMessage.tt

at submit button, enable onclick event.

Code: Select all

onclick="clicked(event)"
at end of file,

Code: Select all

<script>
function clicked(e)
{
    var priority = document.getElementById("PriorityID");
    var priority2 = priority.options[priority.selectedIndex].text; 
    if(!confirm('You are selecting priority '+priority2+'. Confirm Submit?'))e.preventDefault();
}
</script>
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
crynof
Znuny newbie
Posts: 24
Joined: 20 Mar 2020, 20:23
Znuny Version: 6.0
Real Name: Camilo

Re: Enable warning popup before submitting form?

Post by crynof »

skullz wrote: 05 May 2020, 20:23 not soo clean way..direct javascript on CustomerTicketMessage.tt

at submit button, enable onclick event.

Code: Select all

onclick="clicked(event)"
at end of file,

Code: Select all

<script>
function clicked(e)
{
    var priority = document.getElementById("PriorityID");
    var priority2 = priority.options[priority.selectedIndex].text; 
    if(!confirm('You are selecting priority '+priority2+'. Confirm Submit?'))e.preventDefault();
}
</script>

Many thanks skullz, is exactly that i need, also i put this code on my CustomerTicketMessage.tt and works!.
It is true that it is not the cleanest way to implement this function, but the important thing is that it works perfectly. I tought that to implement a popup on .tt file was more complicated and not very similar with a normal HTML.


I am very grateful for the help.
Thanks skullz/zzz

Cheers
wurzel
Znuny guru
Posts: 3273
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Enable warning popup before submitting form?

Post by wurzel »

Hi,

usually you can use SLA field for this and set a popup here.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
Locked