This was a silly mistake on my side: those accessing the survey on a mobile device were accessing the published version, which did not include the "Mobile" embedded data.
I figured it out: I created two counters, one for correct attempts (numbers in the required range), and one for incorrect attempts (anything else which is an input, so this excludes pressing keys like backspace, control etc).Depending on the value of the input in the text entry box, I increment one counter or the other. The total number of attempts is the sum of the two counters.var inputElement = document.getElementsByTagName("input")[0];var corr = 0;var incorr = 0;/*The function below checks whether a number is an integer.*/function isInt(x) { return x % 1 === 0;}/*The required range is integers between 0 and 15.*/if ( inputElement.value >= 0 && inputElement.value
Hi ahmedA ,I'll see if I can adapt the code. The main difference is that by "attempt" I mean only introducing numbers in a box *without submitting them*. There is no button click on which I can condition incrementing the counter, I simply have to count how many times the input in a box changes (and that is where my code does not work).The reason for this is because even without submitting an input, participants see on the same screen how an image changes dynamically with their input. (But I also want to count inputs which are outside the permitted range, for which the image does not adapt).
I figured out a solution. It may not be the most efficient one, but it works.If an embedded data field set in JavaScript is called "variable" and it's defined in Block 1, go to the Survey Flow and define a new embedded data field after Block 1, say "variable1", and set it equal to ${e://Field/variable}.
Hi JeffD,My answer is probably too late for you, but I'm adding it in case someone else has a similar question. You can include svg files via JavaScript: they have to be on another publicly accessible site, such as in your Dropbox or Github account.Unfortunately, this doesn't seem to also work for logos (under "Look & Feel"), which can only be added from a Qualtrics library. In my case, this looks very unprofessional because it scales in a terribly pixelated way. Who knows, maybe Qualtrics will allow for svg's at some point.
nicolaigeburek, many, many thanks! It does exactly what I had hoped :)
Hi again, wscampbell , and sorry for the late reply--I was quite busy lately. I have probably made the mistake you refer to.In the end, my coauthor and I decided to show information differently to participants (as researchers, we are free to implement whatever best fits our research questions--and programming abilities). However, parts of your suggested solution using Loop and Merge are still relevant for what we decided to do.So thank you once again!
Thank you, nicolaigeburek !I'm quite busy these days, but I'll try to implement your solution by the end of the week, and let you know how it went.
Thanks for the suggestion, wscampbell ! I tried it, but I get an error about exceeding the character limit per question. I'll have to think of another way to ask the question and to implement it.
LE: My idea is a workaround: it doesn't manipulate the text that participants enter when asked their name. Instead, it only allows them to enter text in a specified format.I think what you need is a Custom Validation (under Validation Types) for the first name entries, and use Matches Regex. This might be of help: https://stackoverflow.com/questions/50048342/html-regex-first-letter-to-be-capitalizedI have just tried setting Matches Regex equal to "[A-Z][a-z]*" (without the inverted commas), and there still seems to be an error, even though the rule seems to work just fine here: https://regex101.com/r/cO8lqs/14Good luck!
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.