ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pear-general
pear-general
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved