I'm not sure if this should be considered a bug or feature request, but this is going to catch someone out.
If you create a form on the front end, import it in a server connect, and then add a validation rule on the server connect side under the server connect inputs, and then reinput the form, it will remove any of the ones added in server connect that are not on the front end as well.
That's particularly an issue for form data, where you can't add validations on the front end. If you change something in the form and reimport, you'll have to add them all over again, or manually add in the new form stuff in the input section.
--
Obviously, you shouldn't be trusting user inputs anyway, but this is a particular annoyance when you have a "form data" on the front end that should have something like a required validation rule.
The same goes for date validation, where it's much easier to handle on the server connect side when using the date selector. For something like that It's so easy to forget about this issue and then allow users to submit invalid data, which I would consider a pretty big security issue.
You can get around this by just having a validation step, but this issue isn't immediately obvious to anyone not aware of it.
Nice find. I believe I've reported the bug for the inverse situation (or something similar concerning form generation), which was fixed a long time ago
I think my bug was concerning form generation, if you re-regenerated the form, it would erase existing (client-side) validations
You first need to add validation on a front-end, and then import the form on a front-end. In such scenario - all (supported by a back-end) your validations will be replicated on a back-end.
Yep, do all the validations on the front end first, then import to the back end. I've always kept in mind that if I re-import the form fields into the server connect again, they will be completely replaced with whatever is coming from the front end page.
Perhaps some validating (irony intended!) and notifications would be good so if a field already exists and is about to be updated, an alert is shown to highlight what's about to change? Or a list of all the fields that will be updated.
The problem is that this fundamentally isn't possible on the front end for things like form data, because there is no function to add validators to them on the front end.
Likewise, when using the date selector, validators don't work great on the front end but work perfectly on the backend because of how the date is posted.
You can get around it by using a validator step, but that really shouldn't be needed when this option already exists.
The simple solution would be for Wappler to simply not overwrite validations on the server connect side if they are present on there but not on the front end. Or have a checkbox to enable/disable this option under import.
On dmx-form-data, there are no front end validators you can add. You can add it to a form using the form data option.
But other than the issue already present in this thread, another issue is that this is not documented anywhere. A new user won't know this is how it works, and they'll be caught out.
That wouldn't really help with the issue reported at it's core, because as mentioned previously, there are times when you just won't want a validator added on the front end.
See:
The simple solution for this issue is to only add the validator on the server connect side, which works perfectly as you'd expect. But if you then reimport the form, that validator will disappear, letting someone post any kind of data since it won't be validated.
(again, you could get around that by adding it in as a validator step, but as I mentioned earlier, it's not intuitive for new users nor should it really be needed when you can just add it under the inputs)