Autoform v0.6.4
Started: 2005-06-28 Updated: 2006-12-31
Progress: 98%
Language: PHP5
OS: Web
License: GPL
Jan 10 2008 News - Version 0.7 is almost ready. Documentation simply needs to be updated to reflect the many many changes that have taken place over the past year. There are several new ways of interacting with and creating forms, as well as the removal of many previous limitations.
Laying out HTML forms is a tedious task, so I created this PHP class to save my sanity. In short, it generates HTML forms and prepares and validates their data upon submission. More technically:
- Creates HTML form fields according to a supplied data structure
- Upon receiving the submission performs server-side validation using regular expression matching (which of course can be customized)
- If validation fails it prepares an error message (for the submittor) outlining the culprit fields. Previously entered field values won't be lost
To use this code, the programmer only needs to specify field names, types, validation and alternative display templates (if desired).|Autoform|automatic php html form field generate validate regular expression|Automates the creation and generation of HTML forms, handles validation, displays fields with data in-tact if there is a validation error.
Example usage
Please check out the demos and their source code at the top-right.
Version 0.6.4
We're quite close to version 1.0 which means Autoform is maturing quickly. However, it's necessary to mention that each version below 1.0 may contain changes which aren't 100% backward compatible. This takes place as I work out the clunkiness and focus on aesthetic/usability aspects of the code. I'm trying my hardest to create function names that shed light on their purpose and ensure that using this object drastically reduces development time. So, if you're considering keeping up with the latest and greatest version make sure your forms don't go untested after you upgrade.
If backward compatibility is ever broken in a new release you'll find out about it and the workaround in the documentation.
Upcoming Features
- Easier to use
- Ability to automatically select a state/country based on a visitor's IP address
- Support for multi-page forms
- Protection against re-submissions
Alternatives
A simple google search turned up clonefish in case you want to try another. Looks like we have much the same idea about how this sort of thing should be done. Mine is fairly new (2005) so clonefish might be some prior art. However, mine will always be free.
Documentation and Demos
Standard Example and its Source
Field Array Example and its Source
Standard Example, its Source and Layout Template
Downloads
31 Dec 2006
0.6.4 has been released
28 Aug 2006
0.6.2 contains prunings and bugfixes
autoform-0.6.2.tar.gz - "Better UI" and "Less Assumptions"
autoform-0.6.2.zip
Changelog
0.6.4
- store values passed to fillValues() in field's definition. find first field with name and no value and store there
- indexed array fields keep their indexed name; treat named-index array fields as normal fields
- set "mode" element of definition for file uploads. defaults to 0755.
- no more ability to manually specify that fields should be arrays ... adds too much complexity
- private method name changes
- "required" validation scheme requires 1 or more non-spaces
- allow checkboxes to NOT have labels, same as radios
- store field values with field definition rather than in the values array
- "This field" to "The following field" in validation messages
- smalltext has size of 5 again
- ability to inject an error using injectError(name, errorMessage)
- "selected" attribute of option tags is now XHTML compliant
- "multiple" attribute select tags is now XHTML compliant
- renamed html() to render() - accepts string containing layout template
- created renderFile() - accepts file name of layout template
- added messagePlural parameter to setValidationPattern() for specifying custom validation schemes
- fix errors with field arrays
- update documentation
- ability to inject error messages, in the case of manually coding email/password matching logic and wanting error messages to show as if from autoform
0.6.3
Validation, Security, Typos
- zip code validation changed to match 5 digits or 5 followed by dash followed by 4
- restored previously forgetten label and field types
- fields expecting an array of options no longer fail when the array is empty
- ensures that fields with options can only be set to one of the specified options
- fixed typo in example.php