How do I extract form field validation rules from any web form, considering that the rule logic is embedded in hundreds of JS libraries?

Viewed 32

I want to extract form field validation criteria (not form data) from multiple websites. Problem is that each site is built with a different front-end framework - Jquery, Underscore.js, Backbone, Formik, Vue, etc. and validation rules are written differently. There are a ton of validation libraries. In some cases, its even plain regex. What would be the best method to extract the logic without downloading the entire JS stack?

Every form field would have an onchange / onblur event that would trigger a JS function. It just seems too complex to start from there. Alternatively, an error message would fire when a field is not filled correctly. I was also considering whether it would be possible to simply read the error message and convert that automatically into regex for validation logic, but that depends on the clarity of the error message.

Or can I recursively check for the function that triggers the error message and somehow decode that to determine the validation rule? Or is the only way to handle this, by downloading the entire JS stack, cruft and all, which I am really reluctant to do?

0 Answers
Related