Can I add custom validation for matrix table per column? | XM Community
Skip to main content

So I have two columns in my matrix table constant sum. The first one has to be answered with a number, the second one has to be answered with a word. Can I program this using match regex in custom validation?

I don't believe you can do this through the GUI with custom validation, no. Custom validation is going to be global across the question rather than on a textbox-by-textbox basis. But you could definitely do this with JavaScript if you're savvy in that space. How does the word in the second column work with your data set? You're just trying to capture both the number and the word in one question? Since the Constant Sum can't/won't add an integer and a varchar together, it seems like the Constant Sum part of the Matrix Table is unnecessary. What's your reason for using the CS and not just a MT Text Entry with custom validation?


Hi JeremyK, thank you for your response. Maybe I should turn it into two questions. Basically I want a number in one column and a unit (let's say euro's or dollars etc.) for that number in the other. I originally had a total in the question, which is why i still had constant sum. I could give text entry a try and turn it into two questions or perhaps use JavaScript. Thanks again.


Thinking about it, you could also use a Side-by-Side question, which you could set custom validation on the columns independently out of the box, no JavaScript needed.
image.pngMy validation was as follows. I tested both columns and I think it'll give you what you're after:
Amount validation: Column Options, Text Entry Validation, Content Validation, Numeric Value
Currency validation: Column Options, Text Entry Validation, Content Validation, Text Only

Hope this helps.


Oh, and here's what the error prompts look like if validation check fails:
image.png


Hi JeremyK, thank you for your help! Worked out great!


Leave a Reply