>> For detailed documentation please view the source <<
|
Available Releases
|
| Version |
State |
Release Date |
Downloads |
Notes |
|
1.0.2
|
stable
|
Apr 28, 2004
|
ntSimpleForm-1.0.2.tar.gz
|
- added support for multiple checkboxes - fixed a bug with returning the completeText variable when a properly validated form is submitted
|
|
1.0.1
|
stable
|
Feb 08, 2004
|
ntSimpleForm-1.0.1.tar.gz
|
- added getHTML() function to return HTML content of form - revised code for toString() to print content returned from getHTML() - minor bugfixes
|
|
1.0.0
|
stable
|
Jun 13, 2003
|
ntSimpleForm-1.0.0.tar.gz
|
- initial release
|
|
- simple validation (ie: is numeric, is alpha)
- returns to the form with proper error messages (ie: for validation, required fields)
- required fields
- email a copy of the submission results to the sender and/or a recipient
- save submission results to a flat file
- email address validation
- direct the user to a "success" screen once submission has met requirements
- toString quick display of form OR display each item individually (allows for flexibility of display)
These are the CSS styles supported by the class:
- ntSimpleFormField - applied to the form element (textbox, checkbox, etc.)
- ntSimpleFormButton - applied to buttons on the form
- ntSimpleFormErrors - applied to error messages
- ntSimpleFormTable - applied to the table for toString output
- ntSimpleFormTableHeader - applied to the header of the table for toString output
- ntSimpleFormTableField - applied to the table field
These actions will be carried out upon form validation:
- emailSender - send an email to the sender
- emailRecipient - send an email containing the results to a recipient
- writeToFile - writes a single delimited line to a flat file
ntSimpleForm Sample
Here is the code that generated the above:
<?php /* ** Get the name of the server, file path, URI and script name ** ** We need to set the following four constants: ** SERVER_NAME -- just the name of the server, like www.mystore.com ** SCRIPT_NAME -- just the name of the store script, which is index.php3 by default ** APPLICATION_ROOT -- The path on the Web server's filesystem where the modules ** directory is found, like /www/ ** EXTERNAL_PATH -- The path from the root of the Web site to the index script. ** Note that ** define("APPLICATION_ROOT", dirname(dirname(__FILE__))); ** is finding the parent of the current directory. */
define("SERVER_NAME", $SERVER_NAME); define("SCRIPT_NAME", basename(__FILE__)); define("APPLICATION_ROOT", dirname(dirname(__FILE__))); define("EXTERNAL_PATH", dirname($SCRIPT_NAME)); ?> <html> <head> <title>ntSimpleForm Sample</title> </head> <body>
<style> .ntSimpleFormTable { background-color:#006CB7; } .ntSimpleFormTableHeader { background-color:#2E9AE5; color:white; font-weight: bold; } .ntSimpleFormTableField { background-color:white; color:black; }
.ntSimpleFormField { background-color:white; color:blue; } .ntSimpleFormButton { background-color:#2E9AE5; border-color:#006CB7; color:white; font-weight:bold; border-style:solid; } </style> <? // include ntSimpleForm class include(APPLICATION_ROOT . '/modules/classes/ntSimpleForm.class.php');
// create new form object $aForm = new ntSimpleForm('ntSimpleForm Example');
/** * Add form fields. The fields will be displayed in the order that you add them. */ $aForm->addTextField('firstField','Enter your name','', true, 'alpha'); $aForm->addTextArea('firstArea','Enter your comments','',true); $aForm->addCheckbox('thebox','Do you want this selection?','Yep'); $aForm->addRadioButton('yesno','Yes', 'Yes', 'Yes or no', true, true); $aForm->addRadioButton('yesno','No', 'No'); $aForm->addSelect('testing','Choose one of these',true); $aForm->addInvalid('testing', 'Select Something'); $aForm->addOption('testing', 'Choice 1', '1'); $aForm->addOption('testing','Choice 2','2'); $aForm->addDate('theDate', 'Select a date'); $aForm->addEmailField('emailAddres', 'Enter your email address',true); $aForm->addPassword('passwordField','Enter your password',true, 'numeric'); $aForm->setCompleteURL('http://www.google.ca'); $aForm->setCompleteText('Thank you for trying <b>ntSimpleForm</b>. <a href="javascript:window.close();">Click here to close this window</a>'); $aForm->addReset('reset'); /** * Add actions. These actions will be carried out once the data * being sent is validated. */ // this action will email the sender of the form (notice the addEmailField above) $aForm->addAction('emailSender','ntSimpleForm Sample', 'Thank you for trying out <b>ntSimpleForm</b>.<br><br>Please Visit http://www.niatech.ca again.','test@niatech.ca'); // this action will store the submission results into a flat file called "test.dat" // with default "|" delimination $aForm->addAction('writeToFile', 'products/ntSimpleForm.dat');
// dislpay the form with the toString method $aForm->toString(); ?> </body> </html>
|
|