I am trying to force the user to enter their age but not less than 17 from the current year.
Hello,
I tried it. I receive this error.
You might needed to also use the formatter to convert to date. I’m not at my computer at the moment so can’t provide screenshots.
You might also check this post …
I checked it. I think i understood a little bit but I just don’t even want to bother giving them access to the database and put it their birthday is not meeting the requirement of the site.
This is going to need more than just a min of the value, it first needs to know the current date.
- Add a Data > Date and Time component first
- Select your Number Input and add a Dynamic Attribute
You want the year from the date and time component then the addYears -17, then the get Year so your bindings formatter will look like
All this will do is set the min parameter of the number field to 2003.
The code should look like
<dmx-datetime id="var1"></dmx-datetime>
<input id="text1" name="text1" type="number" class="form-control" dmx-bind:min="var1.datetime.addYears(-17).getYear(var1.datetime)" required="">
1 Like
Thank you for your help.
It is working perfectly.