Form
This component allow you to catch and protect form submission automatically.
<bloc::form_error>
{msg}<br />
</bloc::form_error>
<form name="form">
....
</form>
<bloc::form_valid>
You submission is ok
</bloc::form_valid>
Two modes are availables to display errors : T (for TOP by default) or I (for INLINE)
If bloc form_valid is present in your template if there is no error after submission, your form will be replaced
with content of form_valid.
- Bloc form_error is only required with display on TOP
- By default, component will catch name form with name `form`
- You can change display mode with formSetDisplayMode()
- You can change the name of form to catch with formSetName()
- You can change the language of form error message with formSetLang()
- You can change the name of input in error message with formSetObjectNames()
- You can assign values for your html form with formInit()
Checking methods :
- notEmpty : check if the input, file, checkbox or radio is empty
- email : check if the input is email
- date : check entry is a date (you can configure date format)
- url : check if input is a url
- alpha, onlyLetter : check if input contains only alphabetic characters
- alphaNumeric : check if input contains only alphabetic characters or numeric characters
- onlyDigit : check if the input contains only number
- charLength : check the length of the string input
- minLength : check minimum length
- maxLength : check maximum length
- equal : check if the inpout value is equal
- inList : check if the input value is in list
- regexControl : check if the input pass your regex
- addError : customize your own error validation and message
Checking methods for file upload :
- fileControl : check if file upload is valid your restriction : file size, file mime/type, file extension
- imgControlWidth : control the width of file image uploaded (possible oparator '<', '<=', '=', '>', '>=' )
- imgControlHeight : control the height of file image uploaded (possible oparator '<', '<=', '=', '>', '>=' )
- imgStrictDimension : control the width and/or height of file image uploaded
Secure your form with captcha :
Please see online examples :
- NotEmpty
- FileControl
- FormIsValid
- RegexControl
- SetMessage
- FormHook
- Ajax Form
- XSSprotect