PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject_FormBuilder » Bug #3662

Request for option to allow turning on/off of addrule feature

Details

Request #3662Request for option to allow turning on/off of addrule feature
Submitted2005-03-01 16:45 UTC
Fromjon dot bertsch at ucop dot edu
Assignedmw21st
StatusClosed
PackageDB_DataObject_FormBuilder
PHP Version5.0.3
OSNA
Roadmaps(Not assigned)

Comments

[2005-03-01 16:45 UTC] jon dot bertsch at ucop dot edu

Description:
------------
I thought this might be a useful option to have in
formbuilder rather than having any no NULL field always
show a "this field required" rule when auto generating
forms.

Reproduce code:
---------------
Add in public vars section:

* Add a reuired flag to no NULL fileds in thhe form -
* if set to true, the fields will
* have a required flag.
*
* @access public
* @see
*/

Add in function generateForm (around line 1290):

if ($this->addRequiredRule == TRUE) {
//ADD REQURED RULE FOR NOT_NULL FIELDS
if ((!in_array($key, $keys) || $this->hidePrimaryKey == false)
&& ($notNull)
&& !in_array($key, $elements_to_freeze)
&& !($type & DB_DATAOBJECT_BOOL)) {
$this->_setFormElementRequired($form, $key);
}
}

In your DO code you can turn it back on for all non-null fields by setting the variable to TRUE or else use the $form->addRule for specific fields. It works for me at least.

Regards

Jon bertsch

[2005-03-01 16:49 UTC] jon dot bertsch at ucop dot edu

The first section cutoff my variable. It should read:
* Add a required flag to not NULL fileds in thhe form -
* if set to true, the fields will
* have a required flag.
*
* @access public
* @see
*/

var $addRequiredRule = FALSE;