In one of my form, I've created a Java Script function to control that vario

In one of my form, I've created a Java Script function to control that various dates entered are business day; the validation works well.
Within the process, there is an opportunity for users to go back to that form to change their data. At that moment, it looks like that the validations of dates is somehow removed from the fields and by default return false, which actually blocked then the whole form (I've added alert in the JS to check if they are displayed, but it's really look like the dates are not validated anymore). But, when the form is re-open using the monitoring view, validations work again... Could you please help me with that? Any idea of where it could come from? Thanks!...

OriginalPostID-100950

OriginalPostID-100950

  Discussion posts and replies are publicly visible

Parents
  • It was not check, I tried to run it again with the Refresh default values check but it didn't work again. JavaScript is the following:
    function validateDay(dayField) {
              var dateString= FormAPI.getValue(dayField).id;
              //Return european format dd/mm/yyyy
              var arr = dateString.split('/');
              var day = arr[0];
              var month= arr[1];
              var year = arr[2];
              var dateString2= year+"/"+month+"/"+day;
              //created using american format yyyy/mm/dd
              var currentDate = new Date(dateString2);
              
              var d = currentDate.getDay();
              if(d > 0 && d < 6)
                        return true;
              else
                        return false;
    }
Reply
  • It was not check, I tried to run it again with the Refresh default values check but it didn't work again. JavaScript is the following:
    function validateDay(dayField) {
              var dateString= FormAPI.getValue(dayField).id;
              //Return european format dd/mm/yyyy
              var arr = dateString.split('/');
              var day = arr[0];
              var month= arr[1];
              var year = arr[2];
              var dateString2= year+"/"+month+"/"+day;
              //created using american format yyyy/mm/dd
              var currentDate = new Date(dateString2);
              
              var d = currentDate.getDay();
              if(d > 0 && d < 6)
                        return true;
              else
                        return false;
    }
Children
No Data