Hi,
on my clients site, you can register for christian events, for example this one: hidden link
If you scroll down, there is the registration form I made with Toolset. As you can see, there are two fields regarding the birthdate and the calculation of your age at the time of the event:
- "Geburtsdatum"
- "Alter bei Veranstaltungsbeginn"
The "Geburtsdatum" is a date picker field as you can see. The "Alter bei Veranstaltungsbeginn" is text, which shows the calculated age after you entered your birthdate in the "Geburtsdatum" datepicker (via JavaScript). It works fine for me and others, but there are also many customers, for which the datepicker filed doesn't work correct for some reason. As a result of this, the client decided to drop the datefield in the upcoming week with a normal text field, where the users enter the birthdate manaually. However, I want to make this text field "sure" with a regular expression in the format of "dd.mm.jjjj". Can I use this the REGEX or DATE function for this?: https://toolset.com/documentation/user-guides/front-end-forms/cred-conditional-display-engine/
If yes, how do I have to use it? For example there have to be an error message, if the user doesn't fill in the birthdate correctly.
My second question is, if I want to calculate the age via PHP (and not via JavaScript) and want to send the data also in the confimation mail after filling out the form, do I have to use a hook for this?: https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data
Thank you for contacting us and I'd be happy to assist.
There is no built-in feature available in Toolset which can be used to pre-format the input in a simple text field, but you can use the custom script for this as explained in this tutorial: hidden link