I have probably written hundreds of html form scripts and validators in my life. I wonder whether M offers an obvious further simplification of this so-extremely-common task. Here is what I mean:
I can embed much form field validation information and attributes into my HTML form itself. For example, my GET may render
<input type="text" name="email" value="<%= email %>" id="email" width="40" class="emailcss" placeholder="e.g., tr...@whitehouse.com" autofocus required />
However, because the server cannot trust the browser, the recipient also needs to know these constraints. For example, my maximum width of 40 was in the html form code, which I need to recheck again with the POST recipient. Moreover, my recipient also has to check that my form really wanted only the fields that the browser sent me back (and not "EMALL").
As good as M::Validator is, it still seems tedious in many (not all) situations. My most common need is for the POST recipient to be smart enough to consult the original GET form, understand the HTML form request, and validate that all the param are exactly correct: only fields that were requested are filled, all mandatory fields have been filled out, all constraints have been met, etc. M has a DOM parser built in, so it can presumably it is unusually well positioned to check the GET form.
This seems like an obvious common need. Has this been written already? Given that this would solve 9 out of 10 form needs for me (and perhaps many others), with most "programming" being merely html form design, am I reinventing the wheel here? As a newbie, my code would be so paradigm-strange that it would surely not qualify for use by others.
If it exists, could someone please point me to it?
advice highly appreciated.
/iaw
PS: None of this obviates the need for M::Validator and/or other lower-level mechanisms (which can still be used). It would just be an additional sub, capable of referring back to the original form.