I’m running into an issue where onBeforeSave is working and functioning in the preview version of my site but not the published site. The error thrown is “TypeError: $w(…).onBeforeSave is not a function”. The error is not thrown and the code works as expected in preview. My code is below:
$w . onReady ( function () {
$w ( ‘#dataset1’ ). onReady ( function (){
$w ( “#dataset1” ). onBeforeSave ( () => {
addUserId ();
return true ;
});
});
});