i do not want the onchange client script to work onload - catalog client script

tanz
Tera Expert

i have written an onload client script  on one date variable, which checks the date field on the backend database on form and populates that date . for ex date - 2024-07-24

 

now i want to change this date , it should not allow past date while selecting dates for same field and throw some alert. now i am trying to check it from onchange client script, but when the form loads it shows the alert and empties the previous date value which was set. can you help on this

3 REPLIES 3

AnirudhKumar
Mega Sage
Mega Sage

That's easy.

There should be a line in your OnChange script that says:

if (isLoading || newValue === '')

 Change that to just say:

if (newValue === '')

 

this is not working

Brad Bowman
Kilo Patron
Kilo Patron

It sounds like you will need to incorporate into the onChange script the same GlideAjax or whatever looks up the date from the database.  Then wrap your existing onChange script in an if condition to not run if newValue = that date.