Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
Demos | ![]() |
![]() |
![]() ![]() |
Reputation | Support forum (255) | Blog (9) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-05-28 (4 months ago) ![]() | ![]() ![]() ![]() ![]() ![]() | Total: 88,720 This week: 2 | All time: 1 This week: 46![]() |
Version | License | PHP version | Categories | |||
formsgeneration 1.0.38 | BSD License | 4 | HTML, Validation, AJAX |
Description | Author | ||||||||
Class that generates HTML forms supporting: Recommendations secure registration and login forms Recommendation for a PHP class to upload large files in chunks What is the best PHP textarea editor class? AJAX functions to update page elements PHP API Key Generator mlm dynamic binary tree code in PHP and MySQL PHP Navigation bar with CodeIgniter Dynamic class for CRUD with MySQL database What is the best PHP grid crud postgresql class? Spell check for PHP Price checking availability using barcode scanner by mobile apps Reading changed check boxes dropdown dependency What is the best PHP youtube video downloader class? What is the best PHP responsive forms generator class? Form validation + form generation + mysqli query+security filter Remote PHP app to alter database What is the best PHP AJAX file upload class? What is the best PHP tab based forms class? Large file upload handler Create file structure based on text string What is the best PHP data validation classes class? What is the best PHP multiple tabs form class? Could you suggest a good form validator? Vectorize a map in defined points Form Listview with dependent field Filtration mechanism How to create related dropdown list box? Job application form how to make I need php class which converts word format to html Implement image CAPTCHA validation What is the best PHP crud class? |
|
Include the forms class directly or use vendor/autoload.php if you install it with composer.
require("forms.php");
Create a form object.
$form=new form_class;
Define the name of the form to be used for example in Javascript validation code generated by the class.
$form->NAME="subscription_form";
Use the GET method if you want to see the submitted values in the form processing URL, or POST otherwise.
$form->METHOD="POST";
Make the form be displayed and also processed by this script.
$form->ACTION="";
Specify a debug output function you really want to output any programming errors.
$form->debug="trigger_error";
Define a warning message to display by Javascript code when the user attempts to submit the this form again from the same page.
$form->ResubmitConfirmMessage=
"Are you sure you want to submit this form again?";
Output previously set password values.
$form->OutputPasswordValues=1;
Output multiple select options values separated by line breaks
$form->OptionsSeparator="<br />\n";
Output all validation errors at once.
$form->ShowAllErrors=1;
CSS class to apply to all invalid inputs. Set to a non-empty string to specify the invalid input CSS class
$form->InvalidCLASS='invalid';
Style to apply to all invalid inputs when you just want to override a few style attributes, instead of replacing the CSS class. Set to a non-empty string to specify the invalid input style attributes
$form->InvalidSTYLE='background-color: #ffcccc; border-color: #000080';
Text to prepend and append to the validation error messages.
$form->ErrorMessagePrefix="- ";
$form->ErrorMessageSuffix="";
Define the form field properties even if they may not be displayed.
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"email",
"ID"=>"email",
"MAXLENGTH"=>100,
"Capitalization"=>"lowercase",
"ValidateAsEmail"=>1,
"ValidationErrorMessage"=>"It was not specified a valid e-mail address.",
"LABEL"=>"<u>E</u>-mail address",
"ACCESSKEY"=>"E"
));
$form->AddInput(array(
"TYPE"=>"submit",
"ID"=>"button_subscribe",
"VALUE"=>"Submit subscription",
"ACCESSKEY"=>"u"
));
Load form input values eventually from the submitted form.
$form->LoadInputValues($form->WasSubmitted("doit"));
Empty the array that will list the values with invalid field after validation.
$verify=array();
Check if the was submitted as opposed to being displayed for the first time.
if($form->WasSubmitted())
{
Therefore we need to validate the submitted form values.
if(($error_message=$form->Validate($verify))=="")
{
It's valid, set the $doit flag variable to 1 to tell the form is ready to processed.
$doit=1;
}
else
{
It's invalid, set the $doit flag to 0 and encode the returned error message to escape any HTML special characters.
$doit=0;
$error_message=nl2br(HtmlSpecialChars($error_message));
}
}
else
{
The form is being displayed for the first time, so it is not ready to be processed and there is no error message to display.
$error_message="";
$doit=0;
}
if($doit)
{
The form is ready to be processed, just output it again as read only to display the submitted values. A real form processing script usually may do something else like storing the form values in a database.
$form->ReadOnly=1;
}
If the form was not submitted or was not valid, make the page ONLOAD event give the focus to the first form field or the first invalid field.
if(!$doit)
{
if(strlen($error_message))
{
If there is at least one field with invalid values, get the name of the first field in error to make it get the input focus when the page is loaded.
Reset($verify);
$focus=Key($verify);
}
else
{
Make the email field get the input focus when the page is loaded if there was no previous validation error.
$focus='email';
}
Connect the form to the field to get the input focus when the page loads.
$form->ConnectFormToInput($focus, 'ONLOAD', 'Focus', array());
}
$onload = HtmlSpecialChars($form->PageLoad());
?><!DOCTYPE>
<html>
<head>
<title>Test for Manuel Lemos' PHP form class</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css"><!--
.invalid { border-color: #ff0000; background-color: #ffcccc; }
// --></style>
</head>
<body onload="<?php echo $onload; ?>" bgcolor="#cccccc">
<h1>Test for Manuel Lemos' PHP form class</h1>
<hr />
Compose the form output by including a HTML form template with PHP code interleaaved with calls to insert form input field parts in the layout HTML.
$form->StartLayoutCapture();
$title="Form class test";
$body_template="form_body.html.php";
require("templates/form_frame.html.php");
$form->EndLayoutCapture();
Output the form using the function named Output.
$form->DisplayOutput();
?></body>
</html>
All examples![]() |
AJAX form submission![]() |
Auto Complete![]() |
Form CRUD![]() |
General Example![]() |
Google Maps integration![]() |
Linked select inputs![]() |
Maps![]() |
Multiple Tabs![]() |
AJAX Form Submission![]() |
Screenshots | ||
Videos | ||
Slides | ||
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Example | Forms class test page script | ||
![]() ![]() |
Doc. | Forms class documentation in HTML format | ||
![]() ![]() |
Data | Javascript class to use with the page element animation plug-in | ||
![]() |
Class | Blog post data source class for the crude example script | ||
![]() |
Class | Example blog post model class for the scaffolding example script | ||
![]() |
Class | Example Blog post presentation definition class for the scaffolding example | ||
![]() ![]() |
Aux. | Define an array with all package class files | ||
![]() ![]() |
Aux. | Country codes definitions for the maps example | ||
![]() |
Class | Forms class file | ||
![]() |
Class | Custom plug-in class to submit forms with AJAX to not need to reload the page | ||
![]() |
Class | Page element animation plug-in | ||
![]() |
Class | Custom plug-in class to auto-complete text entered in text inputs | ||
![]() |
Class | Custom input plug-in class for implementing CAPTCHA tests to prevent robots access allowing only humans | ||
![]() |
Class | Custom input to handle scaffolding CRUD events by accessing data source objects. | ||
![]() |
Class | Example plug-in class to demonstrate how to perform new arbitrary validation types | ||
![]() |
Class | Custom input plug-in class for editing calendar dates | ||
![]() |
Class | HTML editor plug-in input class | ||
![]() |
Class | Custom container input class to layout inputs in tabbed pages | ||
![]() |
Class | Custom container plug-in class to render a group of inputs automatically without separate HTML or templates | ||
![]() |
Class | Custom linked select input class | ||
![]() |
Class | Custom list select input class | ||
![]() |
Class | Custom input plug-in class for implementing a world map location selection input using Google Maps API | ||
![]() |
Class | Custom auto complete input class using database queries with PEAR::MDB2 API | ||
![]() |
Class | Custom linked select input class that retrieves options from a database with the PEAR::MDB2 API adapted by Lukas Smith | ||
![]() |
Class | Custom plug-in class to auto-complete text entered in text inputs that retrieves completion texts dynamically from a database using the Metabase API | ||
![]() |
Class | Custom linked select input plug-in class that retrieves options from a database with the Metabase API | ||
![]() |
Class | Custom auto complete input class using MySQL database queries using MySQLi | ||
![]() |
Class | Custom linked select input class that retrieves options from a MySQL database using MySQLi | ||
![]() |
Class | Custom plug-in class to auto-complete text entered in text inputs that retrieves completion texts dynamically from a MySQL database | ||
![]() |
Class | Custom linked select input plug-in class that retrieves options from a MySQL database | ||
![]() |
Class | reCAPTCHA custom input class | ||
![]() |
Class | Custom container input to manage scaffolding forms | ||
![]() |
Class | Secure form submit input plug-in class to prevent CSRF attacks | ||
![]() |
Class | Custom plug-in class to monitor the progress of upload of a form with files and show a progress bar | ||
![]() ![]() |
Data | HTML editor Javascript class | ||
![]() ![]() |
Icon | AJAX load indicator animation icon | ||
![]() ![]() |
Data | Locations database schema definition in format for the Metabase linked select inputs example | ||
![]() ![]() |
Data | Locations MySQL database schema dump for the linked select inputs example | ||
![]() ![]() |
Data | MarkerClusterer Javascript class by Xiaoxi Wu | ||
![]() ![]() |
Data | Henri Torgemane's Javascript md5 encoding function | ||
![]() ![]() |
Data | Example of noise GIF image to obfuscate the CAPTCHA input images | ||
![]() ![]() |
Data | Example of noise PNG image to obfuscate the CAPTCHA input images | ||
![]() ![]() |
Icon | Upload progress bar stripe background image | ||
![]() ![]() |
Icon | Pulldown menu button icon image | ||
![]() ![]() |
Data | Description | ||
![]() ![]() |
Data | Patch to enable upload progress monitoring in PHP 4.3.11 | ||
![]() ![]() |
Data | Patch to enable upload progress monitoring in PHP 4.4.4 | ||
![]() ![]() |
Data | Patch to enable upload progress monitoring in PHP 4.4.9 (use patch -p0 to apply) | ||
![]() ![]() |
Aux. | Script to install the locations database schema definition in format for the Metabase linked select inputs example | ||
![]() ![]() |
Example | Example to demonstrate how to use the custom date input with the ask age option | ||
![]() ![]() |
Example | Example to show how to define and process a form with AJAX submit plug-in | ||
![]() ![]() |
Example | Example to demonstrate how to use the animation plug-in | ||
![]() ![]() |
Output | Test HTML page generated by the class using test_animation.php script | ||
![]() ![]() |
Output | Test HTML page generated by the class using test_auto_complete.php script. | ||
![]() ![]() |
Example | Example to show how to use the auto-complete text custom input plug-in | ||
![]() ![]() |
Example | Example to show how to render a inputs with the automatic vertical layout plug-in | ||
![]() ![]() |
Example | Example to demonstrate how to use the custom CAPTCHA input plug-in | ||
![]() ![]() |
Output | Test HTML page generated by the class using test_captcha_input.php script. | ||
![]() |
Class | Example to demonstrate how to use the scaffolding and crud inputs together | ||
![]() ![]() |
Example | Example to demonstrate how to use the custom validation plug-in | ||
![]() ![]() |
Example | Example to demonstrate how to use the custom date input plug-in | ||
![]() ![]() |
Output | Test HTML page generated by the class using test_date_input.php script. | ||
![]() ![]() |
Example | Example to demonstrate how validate inputs depending on the state of a checkbox | ||
![]() ![]() |
Example | Example of password encoding before form submission | ||
![]() ![]() |
Output | Test HTML page generated by the class using test_form.html script. | ||
![]() ![]() |
Output | Test HTML results page generated by the class using test_form.html script. | ||
![]() ![]() |
Example | Example to demonstrate how to use the HTML editor custom input | ||
![]() ![]() |
Test | Test script to verify the generation of escaped Javascript strings | ||
![]() ![]() |
Example | Example to demonstrate how to link multiple select inputs | ||
![]() ![]() |
Output | Test HTML page generated by the class using test_linked_select_input.php script. | ||
![]() ![]() |
Example | Example to demonstrate the list select input | ||
![]() ![]() |
Example | Example to demonstrate how to use the Google Maps map location custom input plug-in | ||
![]() ![]() |
Example | Example to demonstrate how to auto-complete a text input with texts from a database using PEAR::MDB2 API | ||
![]() ![]() |
Example | Example to demonstrate how to link multiple select inputs retrieving options from a database with the PEAR::MDB2 API adapted by Lukas Smith | ||
![]() ![]() |
Example | Example to show how to use the auto-complete text custom input plug-in retrieving auto-complete texts from a database using the Metabase API | ||
![]() ![]() |
Example | Example to demonstrate how to link multiple select inputs retrieving options from a database with the Metabase API | ||
![]() ![]() |
Example | Example to demonstrate how to auto-complete a text input with texts from a MySQL database using MySQli | ||
![]() ![]() |
Example | Example to demonstrate how to link multiple select inputs retrieving options from a MySQL database using MySQLi | ||
![]() ![]() |
Example | Example to show how to use the auto-complete text custom input plug-in retrieving auto-complete texts from a MySQL database | ||
![]() ![]() |
Example | Example to demonstrate how to link multiple select inputs retrieving options from a MySQL database | ||
![]() ![]() |
Example | Forms class example to render a inputs in tabbed pages with the paged layout plug-in | ||
![]() ![]() |
Example | Example to demonstrate how to use the reCAPTCHA custom input | ||
![]() ![]() |
Example | Example to demonstrate how to use the scaffolding input | ||
![]() ![]() |
Example | Example to demonstrate how use the secure submit custom input to prevent CSRF attacks | ||
![]() ![]() |
Example | Forms class test page using Smarty 3 plug-in filter | ||
![]() ![]() |
Example | Forms class test page using Smarty 2 plug-in filter | ||
![]() ![]() |
Example | File uploading example. | ||
![]() ![]() |
Example | Example to show how to use the form upload progress custom input plug-in |
![]() |
/ | smarty | / | 2 | / | plugins |
File | Role | Description |
---|---|---|
![]() ![]() |
Aux. | Smarty plug-in script to insert form data parts |
![]() ![]() |
Aux. | Smarty plug-in script to insert form input as hidden parts |
![]() ![]() |
Aux. | Smarty plug-in script to insert form input parts |
![]() ![]() |
Aux. | Smarty plug-in script to insert form input label parts |
![]() ![]() |
Aux. | Smarty 2 engine pre-filter plugin for form template processing |
![]() |
/ | smarty | / | 2 | / | templates_c |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Apache configuration file to forbid access to all files in this directory. This file is meant mostly to force the creation Smarty compiled templates directory templates_c. |
![]() |
/ | smarty | / | 3 | / | plugins |
File | Role | Description |
---|---|---|
![]() ![]() |
Aux. | Smarty 3 plug-in script to insert form data parts |
![]() ![]() |
Aux. | Smarty 3 plug-in script to insert form input as hidden parts |
![]() ![]() |
Aux. | Smarty 3 plug-in script to insert form input parts |
![]() ![]() |
Aux. | Smarty 3 plug-in script to insert form input label parts |
![]() ![]() |
Aux. | Smarty 3 engine pre-filter plugin for form template processing |
![]() |
/ | smarty | / | 3 | / | templates_c |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Apache configuration file to forbid access to all files in this directory. This file is meant mostly to force the creation Smarty compiled templates directory templates_c. |
![]() |
/ | templates |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Example page footer Smarty template |
![]() ![]() |
Data | Smarty HTML template for composing example form (copy to your Smarty templates directory) |
![]() ![]() |
Data | Smarty template for displaying validation errors in the example form |
![]() ![]() |
Aux. | Date custom input with the ask age option form body template |
![]() ![]() |
Aux. | HTML template with embedded PHP to define the form body for the AJAX submit example |
![]() ![]() |
Aux. | Animation plug-in form template |
![]() ![]() |
Aux. | HTML template with embedded PHP to define the form body for auto-complete text custom input plug-in |
![]() ![]() |
Aux. | Template script to render the inputs of the automatic layout custom input plug-in |
![]() ![]() |
Aux. | HTML template with embedded PHP to define the form body |
![]() ![]() |
Aux. | CAPTCHA custom input form body template |
![]() ![]() |
Aux. | Custom validation form body template |
![]() ![]() |
Aux. | Date custom input form body template |
![]() ![]() |
Aux. | Dependent validation form body template |
![]() ![]() |
Aux. | HTML template with embedded PHP to define the form frame |
![]() ![]() |
Aux. | Linked selects form body template |
![]() ![]() |
Aux. | List select input example form body template |
![]() ![]() |
Aux. | Auto-complete location input example form body template |
![]() ![]() |
Aux. | Google Maps map location custom input form body template |
![]() ![]() |
Aux. | Template script to render the inputs of the paged layout custom input plug-in |
![]() ![]() |
Aux. | Encoded password form body template |
![]() ![]() |
Example | RECAPTCHA custom input form body template |
![]() ![]() |
Aux. | Upload file form body template |
![]() ![]() |
Data | Example page header Smarty template |
![]() ![]() |
Data | HTML template with embedded PHP to display a message feedback window |
![]() ![]() |
Data | Example page wide Smarty template that integrates the form template output |
![]() |
/ | test |
![]() |
/ | test | / | expect |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Expected output of the test_age_date_input.php script |
![]() ![]() |
Data | Expected output of the test_custom_validation.php script |
![]() ![]() |
Data | Expected output of the test_date_input.php script |
![]() ![]() |
Data | Expected output of the test_form.php script showing all client validation errors |
![]() ![]() |
Data | Expected output of the test_form.php script after processing server validation showing all errors |
![]() ![]() |
Data | Expected output of the test_form.php script after processing server validation errors |
![]() ![]() |
Data | Expected output of the setagedate test |
![]() ![]() |
Data | Expected output of the setdate text |
![]() ![]() |
Data | Expected output of the test_age_date_input.php script |
![]() ![]() |
Data | Expected output of the test_custom_validation.php script |
![]() ![]() |
Data | Expected output of the test_date_input.php script |
![]() ![]() |
Data | Expected output of the test_form.php script |
![]() ![]() |
Data | Expected ouput of the test to verify the escaping of Javascript strings. |
![]() |
/ | test | / | generated |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Dummy file to force the generated directory creation |
![]() | formsgeneration-2023-05-28.zip 541KB |
![]() | formsgeneration-2023-05-28.tar.gz 461KB |
![]() | Install with Composer |
Needed packages | ||
Class | Download | Why it is needed | Dependency |
---|---|---|---|
Metabase | ![]() |
Used by the custom linked select plug-in class that retrieves groups of options from many SQL databases | Conditional |
Version Control | Reuses | Unique User Downloads | Download Rankings | ||||||||||||||||
88% | 14 |
|
|
User Ratings | User Comments (20) | |||||||||||||||||||||||||||||||
|
Applications that use this package |
Used to generate forms in this site about training dogs |
If you know an application of this package, send a message to the author to add a link here.
Other classes that need this package |
Class | Why it is needed | Dependency |
---|---|---|
CRUD Class | for generate the forms | Required |
Database access class | Retrieve values of processed form fields | Required |
Date and time utility class | Generates forms with the fields defined by this class | Required |
Ezmlm mailing list manager class | Generate and process forms for creating and editing the mailing lists | Required |
FCKEditor Plug-in | This is a plug in for Manuel Lemos' forms class | Required |
General Validation | This is main class which includes functions for validating | Recommended |
Multipage forms class | Generates and validates the forms | Required |
Navelo CMS | Helping to generate all form in CMS | Required |
Niger | the package is compulsory | Required |
PHP Webmaster Tools API | Present the user interface to configure the options to retrieve the top searched pages | Conditional |
PHPBB Db Tools | PHPBB MySQL Db Tools 1 | Required |
Plugin Cal class | This is the main class | Required |
Secure HTML parser and filter | Used in the secure_html_filter.php Web interface test script | Conditional |
Xinha plug-in | This is the main forms generation and validation class that this plug-in extends | Required |
Related pages |
Pages that reference this package |