https://github.com/a-x-/form-validation-parser
PHP parser for html5 form validation declaration. Make possible basing php server-side addition validation on the already existing client-side html5 form validation declaration.
https://github.com/a-x-/form-validation-parser
Last synced: 3 months ago
JSON representation
PHP parser for html5 form validation declaration. Make possible basing php server-side addition validation on the already existing client-side html5 form validation declaration.
- Host: GitHub
- URL: https://github.com/a-x-/form-validation-parser
- Owner: a-x-
- License: agpl-3.0
- Created: 2014-09-08T23:30:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-23T08:48:04.000Z (over 10 years ago)
- Last Synced: 2025-01-11T01:59:23.619Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 191 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
form-validation-parser
======================PHP parser html5 form validation declaration. Make possible basing php server-side addition validation on the already existing client-side html5 form validation declaration.
# Usage
For example, Parsing the html code
```html
...
Submit...
```return the structure:
```js
{
"my-data": {
"required": {
"user_email": {
"type": "email", // It is standart HTML5 type.
"sample": "[email protected]"
}
},
"optional": {
// Pattern provide base validation only ad hoc. Type definition provide full validation layer.
"user_ip": {
"type": "ip", // It is not HTML5 standart type, which must be defined additionally
"sample": "127.0.0.1"
},
"the-system-id": {
"pattern": "#\d+", // There is (full validation qualified) pattern only.
"sample": "#312"
},
"magic-foo": {
"type": "number",
"sample": "",
"params": {"min":2}
}
} // optional
} // my-data
}
```# Status
First limited pre-alpha version complete!
| **Idea** | Alpha | Beta | RC | Production |
|:--------:|:-----:|:----:|:--:|:----------:|
| Ok |Pending| — | — | — |# Dependencies
* [Cheerio](https://github.com/cheeriojs/cheerio) for DOM parsing.
+ See about
- [page](http://cheeriojs.github.io/cheerio/),
- [tutorial (Russian)](http://catethysis.ru/cheerio-node-js/).
+ Another ways:
- [xpath lib tutorial (Russian)](http://vasinnet.blogspot.ru/2013/04/nodejs-html-xml-xpath.html),
- [htmlparser2](https://www.npmjs.org/package/htmlparser2) — HTML/XML/RSS parser **for Node.js**,
- [node-htmlparser](https://github.com/tautologistics/node-htmlparser) — HTML/XML/RSS parser written in JS for **both the browser and NodeJS**.
- [dom parsers benchmarks](http://habrahabr.ru/post/163979/).
- [question on stackoverflow](http://stackoverflow.com/questions/7372972/how-do-i-parse-a-html-page-with-node-js).# Demo
# TODO
* Make possible parsing array form items such as: `user[email]`, `user[address][street]`, etc.`
* Implement polymorphic endpoints (hrm... what i would said?).
* Check for identity default value for disabled and hiden fields. Add no strict mode for ignoring this checking.# License
All under MIT license.
# Contribution
You're welcome!
I watch github issues and mailbox ([email protected]).English typo-fixes are welcome too.