I have a client that is using Qualtrics as a registration tool. As part of the form they have four text boxes that they want filled out:
* Title
* Media
* Dimensions (height x width x depth)
* Price
I've gotten validation on Price that I am happy with but could use help with the others:
* Title - cannot be na, n/a, NA, N/A, not applicable
* Media - cannot be na, n/a, NA, N/A, not applicable or more than 30 characters in length
* Dimensions - want to make sure it is [1-99] X [1-99] X [0-99] where it allows decimal places and is checking for three numeric dimensions separated by X or x
I know that dimensions might be more easily achieved by breaking it into 3 text boxes. However, I would either have to glue it back together to the format above (which I am blanking on how to do) or make the respondents write it that way. My clients are not computer savvy and cannot handle the three dimensions being in separate columns in the data they view - most are not even comfortable opening an Excel file.
Any help you can give is appreciated. I feel like I shouldn't be struggling with this but it is throwing me for a loop.
Thank you!
Page 1 / 1
Are all fields required?
Yes they are all required.
On the second field, you can add a maxlength attribute to it using JavaScript. That way the respondent can't type more than 30 characters.
On the first two fields, you can use JavaScript to add 'blur' event handlers to check the value of input and change it to empty if it is equal to na, n/a, NA, N/A, not applicable.
On the third, I would use JavaScript to add an 'input' event handler to validate as they type. Each time they enter a character you parse and format the input value throwing out anything that doesn't meet the requirements.
On the first two fields, you can use JavaScript to add 'blur' event handlers to check the value of input and change it to empty if it is equal to na, n/a, NA, N/A, not applicable.
On the third, I would use JavaScript to add an 'input' event handler to validate as they type. Each time they enter a character you parse and format the input value throwing out anything that doesn't meet the requirements.
@TomG thanks for the reply. Not being strong in Javascript it was hard for me to follow through on your suggestions but it got me thinking about Regex. I was able to come to a "close enough" solution using Custom Validation and Regex.
For anyone who's interested:
* Title Custom Validation: Title Matches Regex ^((?!not applicable).)*$ AND Title Matches Regex ^((?!n/a).)*$
* Media Custom Validation: Media Matches Regex ^((?!not applicable).)*$ AND Customer Matches Regex ^((?!n/a).)*$ Then in a new Logic Set AND Media Matches Regex ^([^<>]){1,30}$
* Dimensions Custom Validation: Dimensions Matches Regex ^(\\d*\\.?\\d*)(\\s[xX]{1}\\s(\\d*\\.?\\d*)){2}$
For anyone who's interested:
* Title Custom Validation: Title Matches Regex ^((?!not applicable).)*$ AND Title Matches Regex ^((?!n/a).)*$
* Media Custom Validation: Media Matches Regex ^((?!not applicable).)*$ AND Customer Matches Regex ^((?!n/a).)*$ Then in a new Logic Set AND Media Matches Regex ^([^<>]){1,30}$
* Dimensions Custom Validation: Dimensions Matches Regex ^(\\d*\\.?\\d*)(\\s[xX]{1}\\s(\\d*\\.?\\d*)){2}$
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.