Solved
Is it possible to add a Custom Validation Message from the Library into javascript?
Hi,
I'm using some javascript from case nr 4 on this document that I found:
https://psrc.princeton.edu/sites/psrc/files/html_tips_tricks.pdf
But I wondered if it is possible to call up a custom validation message from the Message Library instead of a hardcoded error text.
So instead of:
var customErrorMessage = 'Write your message here';
to have some variable that uses a specific message from the Library.
Especially because Library messages support translation, I'm hoping that this way I can make my error message multilingual.
(And no, I can't just use the Custom Validation option instead of JavaScript because the Graphic Slider question type doesn't support Custom Validation)
Best answer by ahmedA
One workaround would be to place the required warning messages as question texts. Then you can use the method mentioned above. Your custom error message would be
"${q://QID128/QuestionText}". These questions could be hidden using the display logic set to false.Ideally it should it work with translations (I haven't tested it) and just to be safe, ensure that these questions are somewhere in the survey, before the custom message is required.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
