How to create a Pop up on a selected variable

Sean Kingston1
Giga Contributor

Looking for a Client Script that will Popup a message on a selected variable.. If "No" is selected then a set of instructions will pop up

6 REPLIES 6

Chuck Tomasi
Tera Patron

Hi Sean,



Something like this might do it in an onChange client script.



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


  if (newValue === '') {


      return;


  }


if (g_form.getValue('u_field') == 'true') {


        confirm("Are you sure?");


}


}


Hi Chuck,



How would one adjust the script for a date variable, say if the selected date is 7 days less than current date and display a message "your order may not be fulfilled by..."



Kindest Regards,




Mohammed


Working with dates on the client script is never any fun (to me anyway.) The Date object has some methods that can help. If I were to dig in to this, I would work with a numeric value of the date (typically in milliseconds) and determine if the difference was 7*84600*1000 (7 days, 86400 is seconds per day, 1000 makes it millseconds) or 604,800,000.


Thank you for that Chuck, appreciate your advice