- SimpleForm use em tag to show the tips of an input element
- pattern="email" empty="please fill in email address" valid="true" unvalid="Unvalid Email Address" valid-css="good_input" unvalid-css="error_input"
- vali Parameter: when valid = true, the input box will be green£¬no tips£» when valid="some text..."£¬the input box will be green£¬and tips will behind input box
-
1.
<form method="post" action="test.php" class="simpleform" onvalid="submitForm()">
When click submit, and all the input element is fine, form will eval the function in onvalid parameter -
2.
<form method="post" action="test.php" class="simpleform" data-action="submitForm">
When click submit, and all the input element is fine, form will post the data to test.php and pass the data from server to the function in data-action parameter
Parameter for Input Element:
-
regex
the regular expression for input element, make an expression yourself, or use email,ip,url,date,datetime,int,float,password
-
valid-css
the css apply to input element when all is fine
-
unvalid-css
the css apply to input element when something is wrong
-
empty
when the input element is empty, show the text in empty parameter
-
unvalid
when the value is not fit with regex, show the text in unvalid parameter
-
valid
default value valid=true. when the value is fit with regex and the valid has some text for tips, show the text in valid parameter
-
forcevalidate
On default, SimpleForm will not check the hidden input element, add a forcevalidate to an input element will check the hidden input element.
-
empty-group
In some case, we have A input box and B input box, while A or B has a something, that's ok.But it can't be both is empty.we can use empty-group="#a-input,#b-input"
-
regex="equalto:#a-input"
the input value must equal to a-input,just like an confirm password.
-
regex="func:checkemail"
the input value must equal to function's return value
-
regex="ajax:/valid-username.php"
Post the input value to server, check the value whether ok