Page 1 of 1

Alert popup (Yes/No) on change of a lookup field

Posted: 09 Jun 2017
by vegard.grutle
Hi!

I have a lookup field 'Case Type' which has related fields. Based on the value picked in the dropdown some fields are hided. In addition im running a script which is wiping out values in some fields based on a criteria.

What I want to achieve is an alert pop up when the value in the 'Case Type' field is changed after it has been submitted for the first time. So basically the alert should be triggered only on the edit form.

The alert should say somthing like "Are you sure you want to proseed?" and the user should be able to chose 'Yes' or 'No'.

Is there an easy way to implement this?

Thanks!

Re: Alert popup (Yes/No) on change of a lookup field

Posted: 09 Jun 2017
by Dmitry Kozlov
Hi,
You can save a flag indicating whether a user has already switched the option either in cookie or in a separate field and check if before showing a confirmation dialog:

Code: Select all

// settings a cookie for the current item:
$.cookie('CaseTypeChanged_' + GetUrlKeyValue('ID'), '1');

// getting a cookie for the current item:
if (!$.cookie('CaseTypeChanged_' + GetUrlKeyValue('ID'))) {
  // show a confirmation
}