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)
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)
Page 1 / 1
We wanted to do the same thing, trying to use text from a message library in javascript in the header of a survey or theme. We asked Qualtrics support several years ago, and they said there was no way to retrieve message library items in javascript. Only embedded data fields, like this ${e://Field/varname}.
It would certainly be useful to be able to reference message library text, because of the translation capabilities. So far, looks like it's still not possible.
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.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.