Usage of “Forms and Validation”
The creation of HTML-forms is a time consuming task. Also the creation of validation rules has to be done and is always quite similar and still has to be tested intensively. The PHP class “Forms and Validation” can reduce the necessary time to create input forms on your website to a minimum. In addition there are a lot of validation rules included to make your life easier.
I created some examples to show you how easy you can use this PHP class (click on “live preview” so see them). You can try every example by your own to get an feeling for the power of the creation and validation capabilities and this class. Also you can directly see the used source code to boost your learning curve of this class functions. In the end there is a complete list of the public functions of this class.
I hope this class saves you a lot of time so you can focus on the real challenging programming tasks.
Integration
The installation of “Forms and Validation” class is very simple and saves you a lot of time. Just follow the following installation steps and you will see how easy it is to create forms and validate them.
- Copy the php and css file to any location of your webspace (e.g. to the directory /fav)
- Make sure that you can use sessions in the target file: “session_start();”
- Initialise the class: “require_once(‘formsAndValidation_class.php’);”
- You are ready to start… (best would be to start with one of the examples from the README)
- Adapt the css file to your need.
- Have fun, save a lot of time and give me a good rating on code canyon
Features
- Super easy to integrate (include one file and you are ready to go)
- create all html form types with one line of code
- multiple pre-defined validations included
- define own validations or use regular expression
- change the css file to create a new look of the form
Public functions of the “Form and Validation”
please click on live demo to get an explanation for all functions…
Functions to define the eneral settings of the class:
- setTarget( string $target )
- setMethod( string $method )
- setShowErrorsOnForm( bool )
- setShowErrorsOnTop( bool )
- loadVariables( array $keyAndVariables )
- setLoadDatepicker( bool )
Functions to create the form:
- addTextInput( string $label, string $name [, string $value = ’’, array $attributes = array(), string $addtext = ’’] )
- addPassword( string $label, string $name [, string $value = ’’, array $attributes = array(), string $addtext = ’’] )
- addUpload( string $label, string $name [, string $value = ’’, array $attributes = array(), string $addtext = ’’] )
- addHiddenInput( string $label [, string $name = ’’] )
- addTextarea( string $label, string $name [, string $value = ’’, array $attributes = array(), string $addtext = ’’, int $rows = 4, int $cols = 20] )
- addSelectList( string $label, string $name [, array $option_list = array(), array $attributes = array()] )
- addRadioButton( string $label, string $name [, array $option_list = array(), array $attributes = array()] )
- addCheckboxes( string $label, string $name [, array $option_list = array(), array $attributes = array()] )
- addDefaultValue ( string $name, string $value )
- addCode ( string $name [, string $location = ’’] )
- addTitle ( string $text )
- addHeadline ( string $text )
- addParagraph ( string $text )
- showForm ( [ string $submit = ‘send’ ] )
Functions to validate the form:
- save2Session ()
- cleanSession ( [ string $formID = ‘fav’ ] )
- isEmpty ( string $field, string $error_msg [, int $minChars = 3 ] )
- isInteger ( string $field, string $error_msg )
- isDecimal ( string $field, string $error_msg )
- isWithinRange ( string $field, string $error_msg, int $min, int $max )
- isEmailAddress ( string $field, string $error_msg )
- isSelected ( string $field, string $error_msg )
- isFile ( string $field, string $error_msg )
- isFileType( string $field, string $error_msg, array $allowed_file_types )
- isFileSizeGreaterThan( string $field, string $error_msg, int $size )
- isFileSizeSmallerThan( string $field, string $error_msg, int $size )
- isValidDate ( string $field, string $error_msg [, string $format = ‘mdY’, string $sep = ’/’ ] )
- isFutureDate ( string $field, string $error_msg [, string $format = ‘mdY’, string $sep = ’/’ ] )
- checkWithRegExpression ( string $field, string $error_msg, string $regExp )
- checkWithOwnValidation ( array $field_names, string $error_msg, string $validation )
- checkReload ( string $error_msg )
- AddError ( string $error_msg )
Functions to deal with the errors:
- isError ()
- getErrorCount ()
- getErrorList ()
- showSuccess ( string $headline [, string $text = ’’] )
- resetErrorList ()
Please help me
If you are going to rate the script less than 5 stars, please tell me what I can do to make it 5 stars for you and I will fix it. I would love to hear your suggestions on how I could improve the script, leave me a comment or send me an email and your suggestion might make it in to a future version!
[eltd_button size=”huge-full-width” type=”outline” text=”Download & Demo Links” custom_class=”#” icon_pack=”font_awesome” fa_icon=”” link=”” target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Demo = Forms and Validation
[eltd_button size=”huge” type=”” text=”Full Live Demo” custom_class=”” icon_pack=”font_awesome” fa_icon=”fa-laptop” link=”https://codecanyon.net/item/forms-and-validation/3833215″ target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Kindly Note: We update new contents like WordPress Themes, Plugins, PHP Scripts everyday. But remember that you should never use this items in a commercial website. All the contents posted here for development & testing purpose only. We’re not responsible for any damage, use at your own RISK! We highly recommend to buy Forms and Validation from the The Developer ( christophdb ) website. Thank you.
Download = Forms and Validation-[Updated].zip