I want to validate, that for certain answers, only integer numbers can be entered (i.e., only 6 or 7 and not 6.4 or 7,3).
I found this java code quiet handy:
jQuery("#"+this.questionId+" .InputText").attr({'type':'number','min':'0'});
(I found it here: https://www.qualtrics.com/community/discussion/1125/how-to-set-a-field-to-number-only )
Unfortunately, it still allows floating numbers and even minuses. It seems, that 'type' cant simply changed from 'number' to 'integer' (I am not really into JavaScript).
May anyone help me? I already have a workaround using custom validation and RegEx code (^\\d*$) but for some reason, this custom validation doesn't react in a "Form"-Question. Nevertheless, I also prefer the Java-solution, which from the beginning prohibits entering text and allows only numbers (and also "," and "." ¯\\_(ツ)_/¯ )
Happy for any suggestions!
Best answer by TomG
View original