Confirm popup box on Portal

Sam Ogden
Tera Guru

Hi All,

I'm trying to add a confirm box on a record producer for our service portal.   I've got the below code, when I go through the 'try it' button the confirm box appears, but regardless of if I select 'ok' or cancel it still submits the record.   I need it to only submit if 'ok' is selected and to return to the form if 'cancel' is selected.  

My other issue is when I tried to run this by logging into the portal when I clicked submit on my form the confirm box never appeared?

find_real_file.png

Any help is greatly appreciated.

Thanks

1 ACCEPTED SOLUTION

Chris M3
Tera Guru

I haven't done anything in the service portal, but I believe you need to return the confirm response



so


function onSubmit() {


      return confirm("Please confirm");


}


View solution in original post

7 REPLIES 7

I am trying the same thing and return confirm () isn't popping up in the portal for me.   My UI type is already set to Both and I've commented out everything possible.   This works fine in the ITIL backend view, but in the portal nothing pops up:



find_real_file.png



Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Hi Steven,



The above was on a record producer, but I do have a popup box on a catalog item that is working.



find_real_file.png



I think you might need the IF statement in place before the return confirm so it knows when to produce the popup message?


Madhu27
Tera Expert

Sam, you have to process your popup box answer as follows



var answer= confirm( ".....");


    if (answer== true)


                            {


                            //your script to ok should come here


                      }


                      else


                            {


                            return false; //stops the submission of form


                      }