RE: [fw-general] Zend_Filter_Input fields metacommand not working as described

2007-08-10 Thread Bill Karwin
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Joshua Ross
> 
> When using the fields meta command if the rule name is different than 
> the fields metacommand then to access the value via magic accessors 
> you should use the rule name not the fields name, correct?  That is 
> what is implied in the documentation.

No -- The rule name is used in keys of the assoc array returned by
getMessages() and getErrors(), because messages correspond to validator
failures, not individual input data fields.

You need to request the field value by the field name, not the rule
name.  Because multiple rules might have been applied to the field
before it is ready to be retrieved.

The value is returned after it has been filtered and validated by all
applicable rules.

Regards,
Bill Karwin


[fw-general] Zend_Filter_Input fields metacommand not working as described

2007-08-10 Thread Joshua Ross
I am having another issue using the Zend_Filter_Input fields metacommand. 
When using the fields meta command if the rule name is different than the 
fields metacommand then to access the value via magic accessors you should 
use the rule name not the fields name, correct?  That is what is implied in 
the documentation.


For example, if you have the following Zend_Filter_Input:

$validators = array('myfield' => array('fields' => 'somefield'));
$input = new Zend_Filter_Input(array(), $validators, 
$this->getRequest()->getParams());


Then you should be able to use the rule name 'myfield' as a magic accessor 
to retrieve the 'somefield' value:


echo $input->myfield;

This returns null.  The 'somefield' value is only available via magic 
accessor using 'somefield' as the rule name:


echo $input->somefield;

The problem is that I am not entirely sure that the value accessed using 
$input->somefield has actually been properly validated or filters(beyond 
standard htmlentities).  I tested this using the fields command with a 
string value and an array of string values, both return null when attempting 
to access the value using the rule name.


I believe this is a bug however I am surprised no-one else has ran into this 
problem.  Is there something I missed in the documentation or am I doing 
something wrong here?  If not, shall I add this to the issue tracker?


Thanks,
-Joshua-