How to create a alert message on multiple text entry (form) inputs? | XM Community
Skip to main content

Hi in my survey i have a question where responded have two text entries to fill.
1) Hours ________ (content validation numeric)
2) Minutes __________(content validation numeric)
I want to display and alert when a respondent enters something greater than 16 in hours filed. I have tried the following code on Ready and it does not seems to be working.
var q1 = jQuery("#"+this.questionId+"input[type=text]").eq(0).val();
if(q1 > 16) {
alert("Please check if your work time is correct");

How can i do this effectively i just want a warning where respondent can go proceed even if they get warning.

Personally I would create two separate test entry questions instead of a multiple entry question. It will look the same (or very similar) to participants and you can add separate min and maxes to each question for validation.


https://www.qualtrics.com/community/discussion/comment/31830#Comment_31830Min and max can be added to the question i presented as well i guess, i was looking more towards warning which is not totally an error.


For any one looking for it I found the answer myself after going through a lot of hassle.
var msg = 'Your message'
var that = this.questionId;
jQuery("#" +that+" .InputText").on('blur',function(){
var q1 = jQuery("#"+that+" .InputText:eq(0)").val();
if(q1 > 16) {
alert(msg);

});

The above code is just to check in the first field.


Leave a Reply