How to do some date validation here so that when user enter end date less than start date it will prompt error to user? Is there any built in function made by AppMaker? Thanks for sharing!
0
votes
1 Answers
2
votes
If you want to limit the input to a data model, you can use the Advanced section of the data model.
![1]](https://i.stack.imgur.com/QdbWX.png)
You can also achieve data validation through Event section or Data Validation section. Use the the first one to implement small scripts and the second one to hardcode rules into the app.
// date is not a previous date
var date = new Date();
if (widget.value < date) {
alert('Invalid date');
}
// date is not a future date
var date = new Date();
if (widget.value > date) {
alert('Invalid date');
}
// second date is not higher than first date
if (widget.value > widget.parent.descendants.firstDate.value) {
alert('Invalid date');
}
![2]](https://i.stack.imgur.com/f2paU.png)
