For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > Re: [PEAR] timeOptions and dateOptions methods for FormBuilder :)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] timeOptions and dateOptions methods for FormBuilder :)
Justin Patrin

2005-05-10, 8:57 pm

On 5/9/05, pear@electroteque.org <pear@electroteque.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 :)
>=20
> 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).
>=20
> Here is how i did it.
>=20
> in the do
>=20
> function timeOptions(){return array('addEmptyOptions'=3D>true);}
>=20
> Now my big question, how can i set global for a certain page that no fiel=

ds
> are required especially for not null fields. This is important for a sear=

ch
> 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 ...
>=20


This isn't possible. However, if you had looked at my Frontend code...

You can quite easily stop all rules using this:
$form->_rules =3D array();
$form->_formRules =3D array();
$form->_required =3D 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 =3D false;
function table() {
$table =3D parent::table();
if ($this->_searchForm) {
foreach (array_keys($table) as $key) {
$table[$key] =3D $table[$key]
& ~DB_DATAOBJECT_NOTNULL;
}
}
return $table;
}
}
--=20
Justin Patrin
Dan Rossi

2005-05-11, 3:58 am


On 11/05/2005, at 3:17 AM, Justin Patrin wrote:
>
> 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.
>
>


I just discovered another setting, this turns off all required fields,
but u can also select some not required in an arrya

array('excludeFromAutoRules'=>'__ALL__')

I also tweaked formbuilder with an option fieldsRequired =
array('date','time');
Dan Rossi

2005-05-11, 3:59 am


On 11/05/2005, at 10:40 AM, Justin Patrin wrote:
>
> You mean you added an option to do this?
>
> --
> Justin Patrin
>
>


If you dont mind ? I'll get a diff today.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com