InputText attributes for textual Matrix Table | XM Community
Skip to main content
Solved

InputText attributes for textual Matrix Table

  • April 7, 2019
  • 6 replies
  • 75 views

WaterSampler
Level 2 ●●
Forum|alt.badge.img+1
Have a matrix table for text entry that is 2x2 for entering results of testing 2 samples 2 times. Many users will be using mobile devices so we want to set the InputText attribute to 'number'. For a single text entry the code (thanks to TomG) is: jQuery("#"+this.questionId+" .InputText").attr('type', 'number'); This does not work for the 2x2 MT. Have tried the following with all 4 of the addresses enumerated (1~2, 2~1, 2~2): jQuery("#"+this.questionId+"#1~1"+" .InputText").attr('type', 'number'); jQuery("#"+this.questionId+"~1~1"+" .InputText").attr('type', 'number'); Been searching for about 4 hours without finding anything. thanks

Best answer by Anonymous

Hello @WaterSampler , Use the below code: var input = jQuery("#"+this.questionId+" input[type='text']"); input.attr('type', 'number'); input.on('input', function() { this.value = this.value.replace(/e/g, ''); });

6 replies

WaterSampler
Level 2 ●●
Forum|alt.badge.img+1
  • Author
  • Level 2 ●●
  • April 7, 2019
Forgot this link to the original answer: https://www.qualtrics.com/community/discussion/1125/how-to-set-a-field-to-number-only

  • Answer
  • April 7, 2019
Hello @WaterSampler , Use the below code: var input = jQuery("#"+this.questionId+" input[type='text']"); input.attr('type', 'number'); input.on('input', function() { this.value = this.value.replace(/e/g, ''); });

WaterSampler
Level 2 ●●
Forum|alt.badge.img+1
  • Author
  • Level 2 ●●
  • April 8, 2019
Almost @Shashi. The keypad is now numeric and shows a decimal point but the decimal cannot be entered. Our values are entered in tenths (e.g., 10.5). Many thanks.

  • April 8, 2019
> @WaterSampler said: > Almost @Shashi. The keypad is now numeric and shows a decimal point but the decimal cannot be entered. Our values are entered in tenths (e.g., 10.5). > > Many thanks. I tested this, and it allows decimals. Are you using Safari ? On which browser are you testing ?

WaterSampler
Level 2 ●●
Forum|alt.badge.img+1
  • Author
  • Level 2 ●●
  • April 8, 2019
Tried on an android phone with firefox. Firefox was put on because default google browser did not work with earlier tests. Decimal problem is with Firefox. Many thanks again!

WaterSampler
Level 2 ●●
Forum|alt.badge.img+1
  • Author
  • Level 2 ●●
  • April 18, 2019
Update. The decimal functionality is browser dependent. A fix was to modify the @Shashi code to: var input = jQuery("#"+this.questionId+" input[type='text', step='0.1']");