I have several datepickers on my form and I would like to change the required message for only one of them.
You can create a script validator that passes a message in the validation key.
1 Like
Does it mean I need to remove requirement condition (I have it as “true”) and use script validator instead? I assume I need to check if datepicker is null but what about a message? Could you give me an example how to do this in code?
You’re right, you need to remove the requirement condition and attach the script validator.
In the validator create such a condition:
if (newDate == null || newDate == "") {
return [{
'key': 'pl.emptyPaymentDate',
'parameters': [newDate, 'Wybierz nowy dzień spłaty raty']
}];
After connecting the validator, remember to add the key pl.emptyPaymentDate and the content of the message in the tab “Tłumaczenia”.
1 Like