Martin Friedel
Mega Sage

 

Hello,

 

try this onChange Client Script code, replace <duratiion field> with your field name:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '')
      return;
   
   var duration = g_form.getIntValue('<duration field>');
   
   if (duration > 8 * 60 * 60 ) {
      g_form.showFieldMsg('<duration field>', getMessage('Maximum allowed duration is 8 hours'), 'error');
   }
}

Also you can reuse the code logic in your onSubmit Client Script.

 

If my answer helped you, please mark it as correct and helpful, thank you 👍
Martin