1
I’m studying ways to validate forms. I’ve tried it with Javascript, HTML5 features and some other methods, but they all have something in common.
Always have to call a function in onclick(), onblur() and the like.
I wouldn’t want to do that, since removing this from the code, all validation would be circumvented. So I thought of ways to do some sort of validation that doesn’t have to be called the click of a boot or something. This example of the gmail site made me curious:
Note that HTML5’s Patterns or required are not used or no Javascript function call via clicks. Does anyone have any idea how this validation was done?
This google front-end validation can also be circumvented :)
– MarceloBoni
If you want to make an effective validation, you should do it in the back end
– MarceloBoni
In fact, there are many ways to validate the client. But there is a golden rule: never rely on customer validation. It can be bypassed regardless of the implementation (HTML5 validation or javascript). Always validate also on the server the received data. HTML5 validation is something very simple, and the behavior depends on the browser (ie, you can not customize much). Javascript validation is something more advanced (allows higher.
– mrlew
The events you refer to (
onclick
,onchange
) may be next to the input (inline), or may have been declared somewhere else in the code (as is probably the case for gmail), through aaddEventListener
, for example, and the decision where to place depends on the organization of your code and your project. In fact, putting these inline events is a little recommended practice, because of the principles of separation of concepts (html is html, style is style, script is script). Broadly speaking, that’s it, but surely that’s just one Overview.– mrlew
http://answall.com/q/13298/101
– Maniero