Here is a document how to validate POST data via pure HTML.
(A) How to get POST's indexes should be received?
Just get "name" attributes in the HTML.
# Though it is difficult to treat array like hobbies[], I skip it now.
(B) How to get field's title?
This system gets field's title from <label> corresponding the <input> from HTML.
(C) How to judge whether the field is essential or not?This system judges them by their filed's name.
If a field contains '_required' in its name, the field will be regarded as essential.
refer the sample HTML in (1).
The field of 'name_required' is essential.
You can specify validation rule by "class" of <input>. (pico >= 1.51)
refer the sample HTML in (1).
<input> for 'name' has the class of "required".
Then the field will be essential.
(D) How to do "TYPE-SAFE" or "TYPE-AUTO-CONVERSION"?
This "type" contains not only int,double,string etc, but also "telephone number","email address" etc.This system judges them their filed's name like (C).
eg) if a field contains 'email' in its name, the field will be validated as "email address".
You can specify validation rule by "class" of <input>. (pico >= 1.51)
refer the sample HTML in (1).
<input> for 'email' has the class of "email".
Then the field of 'email' will be checked by the rule of RFC2822.
Of course, you can specify classes multiply.
If an <input> has class="email required", the field will be essential AND validated as "email address".
genet wrotes:
(C), (D) で悩んでおられるのは、入力必須とかデータ型の変更がid (or name) 属性に影響してしまうのがまずいということですよね?
既に検討済みかも知れませんが、class属性を使ってみてはどうでしょう?class属性は直接見栄えに影響しませんし、スペース区切りでいくつも値を設定できますから邪魔にならないと思います。