I have a list question named members that records the full name of the household member. (John Doe). I want to validate whether the full name is being provided and not the first or last name only. (I know persons like Madonna goes by one name only).
Can you provide some basic syntax that will assist with this? Can I count the number of words in the field and if less than 2, for example, trigger a warning message?
This could be the result of copying through some buffer, or typing on a phone, or something else.
When writing a C# syntax, use straight single quotes like shown below:
when you need to indicate a particular character (as opposed to double-quotes when need to indicate a string).
The validation condition however is not going to count the words in general situation. While it works in the specific case, please note that:
it relies on the actual (though not entirely obvious) behavior of Survey Solutions trimming the content of text answers (which may or may not be continued in the future versions);
it will no longer be correct if you need for example 3 words minimum (changing 1 into 2 in the condition will not be enough in this case), for this example string:
Foo Bar
(note, there are 2 spaces between Foo and Bar).
None of these points is an unsolvable problem, but more importantly answering the question (“…count the number of words…”) precisely requires a precise definition of what a ‘word’ really is.