- 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:
-
regexthe regular expression for input element, make an expression yourself, or use email,ip,url,date,datetime,int,float,password
-
valid-cssthe css apply to input element when all is fine
-
unvalid-cssthe css apply to input element when something is wrong
-
emptywhen the input element is empty, show the text in empty parameter
-
unvalidwhen the value is not fit with regex, show the text in unvalid parameter
-
validdefault value valid=true. when the value is fit with regex and the valid has some text for tips, show the text in valid parameter
-
forcevalidateOn default, SimpleForm will not check the hidden input element, add a forcevalidate to an input element will check the hidden input element.
-
empty-groupIn 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