Re: [PEAR] timeOptions and dateOptions methods for FormBuilder :)
by Justin Patrin other posts by this author
May 10 2005 2:49PM messages near this date
[PEAR] DataObjects issue fixed
|
Re: [PEAR] timeOptions and dateOptions methods for FormBuilder :)
On 5/9/05, pear@[...].org <pear@[...].org> wrote:
> Ok for the life i me i couldnt find these in the docs, I had to sift
> through the API luckily its in PHP :)
>
> I now have my time and dates with emptyoptions which are set as NULL, as it
> was causing alot of issues, especially when i was to use it for searching
> (required not null fields i'll get to in a sec).
>
> Here is how i did it.
>
> in the do
>
> function timeOptions(){return array('addEmptyOptions'=>true);}
>
> Now my big question, how can i set global for a certain page that no fields
> are required especially for not null fields. This is important for a search
> form where i want to build the entire form but only make a few fields as
> required. I'll be going through the code if it requires tweaking ...
>
This isn't possible. However, if you had looked at my Frontend code...
You can quite easily stop all rules using this:
$form-> _rules = array();
$form-> _formRules = array();
$form-> _required = array();
Granted, this is technically editing private vars, but oh well.
You can also stop the required rules by removing the NOT NULL bit from
the types.
class My_DO extends DB_DataObject {
//....
var $_searchForm = false;
function table() {
$table = parent::table();
if ($this-> _searchForm) {
foreach (array_keys($table) as $key) {
$table[$key] = $table[$key]
& ~DB_DATAOBJECT_NOTNULL;
}
}
return $table;
}
}
--
Justin Patrin
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Justin Patrin
Dan Rossi
Justin Patrin
Dan Rossi
|