An open API service indexing awesome lists of open source software.

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.

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.