Buenas tardes amigos.
Estoy colocando un campo de texto para recoger el año con 4 dígitos:
regex(., ‘[1]{4}$’)
la situación es donde o como coloco que el año escrito sea a partir de un año
"escriba el año a partir de 1998 y si escriben uno menor que le de el mensaje de error
…The situation is where or how do I place the written year from a year
"write the year starting from 1998 and if they write one less than that it will give you the error message
if you want to restrict the year entered both to 4 digits (ie your current regex) and a minimum value, you can also treat the (text) field as number and compare it using a relational operator; eg
cuando escribo: regex(., ‘[1]{4}$’) si funciona bien, pero sumado a esto quiero es que cuando escriban un año solo acepte a partir del 2023 y cuando coloco completo: regex(., ‘[2]{4}$’) and .>1998 da el error.
select_one choice with only valid years (1998, 1999 …), so no need for further control on entry. (An appearance, e.g. minimal, might optimize the widget space).
an integer type, with a simple numeric constraint, e.g. . >= 1998 and . <= 2022.
a date type with appearance year and a corresponding min/max constraint. See Question Types - ODK Docs.
If you wish the user to enter a year date, and check its within a specific range, then as @wroos suggests I’d recommend this approach, rather than using say a text-based regex.
regex’es are notoriously hard to interpret by mere mortals, and a straightforward integer constraint, as above, will be a lot easier to understand for anybody looking at your form definition.