Have text already enterred into text answer?

What is the problem? Please be detailed.
Hi, I'd like to be able to have the beginning of a text entry in ODK Collect already entered.

Something like Question: "Enter the rest of your ID number please?" Answer: "VBX3h___" and then the person types in "345" to get a final output of "VBX3h345".

Is there a way to do this with the lettering already printed on the answer line?

An XLSForm answer would be best but I can have a go at using XML also.

Many thanks,

Stuart

Hi @Stuart_GALVMED,

Nice question!

You can use the "default" column to do this. If you enter "VBX3h" in the default column of a text question, that will show up when the person enters their ID number.

One suggestion is to use a regex constraint to make sure the ID number has the right format when they submit their answer. So, for example, if all ID numbers start with "VBX3h" and end with three digits, your regex would look like this:
regex(., 'VBX3h[0-9][0-9][0-9]')

I've attached an example with your question and a regex that should work:
example_defaulttext.xlsx (16.9 KB)

Hope that helps!
Janna

5 Likes

Great answer Janna,

Exactly what I needed.

Many thanks.