When setting a field to required... what MAKES it required?
Permalink Browser Info Environment
Is it just the entry in the auto.js file? Or is there something that gets set on the database end to enforce/require a field to be non-null?
The only think I've found any evidence of is the validation occurring in the block's auto.js file.
Thanks!
- John
The only think I've found any evidence of is the validation occurring in the block's auto.js file.
Thanks!
- John
Type: | Discussion |
---|---|
Status: | New |
All that being said, I have discovered recently that if you put a "validate" function in your block controller, it does appear to get called to perform validation as well. But it's not documented anywhere (grr...), and I haven't tested it out to see if it actually works, how you use it (i.e. how you get the submitted data to test and then how you report back success/failure and the error messages).
So for the time being it's still best to just stick with the auto.js validation.
So for the time being it's still best to just stick with the auto.js validation.
Thanks, Jordan. That makes perfect sense, knowing the audience of WHO is filling these forms out, etc. I was just surprised when I was working on editing a block and realized that there weren't any functions for validation in the controller... and the ONLY place I saw anything was in the JS file. When I normally code forms, I first code the backend validation and then progressively enhance it with JS for a better user-experience... that degrades gracefully in the (rare) case the visitor doesn't have JS.
Thanks for the info!
- John
Thanks for the info!
- John
If you are getting into web programming, you will often hear that validation should occur on the server, not just the client. So at first the C5 way threw me for a loop. But the thing is that someone editing a block is never going to be trying to intentionally mess with the system or circumvent your precautions -- *AND* since javascript is required to use C5's editing interface in the first place, you can rely on it being in place. So this is a special case where it's okay to validate on the front-end only.