For some answers the user will use a capital letter, but in the document the answer comes after a colon, so the capital letter should become a lower case . Is there some setting that you can use at card level to change the first letter of the sentence to lower case, regardless of the user’s input?
If you assign an identifier to that question (e.g., “xxx”) in that question’s integration options, then you can use the following customisation to force the first letter of the answer to be un-capitalised:
(assoc question :action-fn (fn [question value] (set-answer "xxx" (some-> (ustr/uncapitalize value)))))
Generally speaking, the better solution is to apply any such transformations at the clause level instead. As you will see when you insert the above code in the question, it can be weird for the end-user that (the first letter of) his/her answer gets changed when leaving the text field.
Another possibility is to use a validation (in the question’s layout options). You can use the following “regex”:
which essentially says: “the answer must not start with an upper letter A to Z”, and there must be at least one letter after the initial letter. (the “must not” is caused by the circonflex after the opening bracket)
You can then insert an optional warning message that explains why the answer is rejected. Be aware that the answer will effectively be rejected, which is not very user-friendly. Also here I think the better option is generally to transform at the clause level.
Thanks for the proposed solutions, but I agree with you that it would be better to do this at the clause level.
I tried to use @lowercase, but this doesn’t work with a list of texts datafield and this would force the complete input to lower case, for instance “Ik woon niet in Antwerpen” would become “ik woon niet in antwerpen”, whereas it should be “ik woon niet in Antwerpen”. However, it does work with a regular text datafield, but it converts the complete input to lower case letters (including names and addresses that might be part of the user’s input).
Good point, I will add an
@uncapitalize special function in the upcoming release.
You can then do a
@for(?X, @list("Alpha beta", "Gamma delta"), @CONVERT) CONVERT = @uncapitalize(?X)
to “uncapitalize” a list of texts.
That would be great, thanks!