Re: [fw-general] Zend_Filter_Input and unknown fields

2007-11-18 Thread pakmannen

Hi Laurent,

Thanks for the link. Hope that gets taken care of soon. However, I'm still
sort of confused as to how you are supposed to use Zend_Filter_Input. What
if you have a couple of fields in your form that doesn't need a validator,
and doesn't need filtering, but you want to run your escape filter on them?
Are you supposed to do something like:

$field_1 = $input->field_1;
$field_2 = Zend_Filter_HtmlEntities::filter($_POST['field_2']);
$field_3 = $input->field_3;

I dunno, but that looks sort of wrong. Would be nice to have a unified way
of doing filtering, validation AND escaping. 

Or should you just add a filter or validator to every field?

/Jens Ljungblad


Laurent Melmoux wrote:
> 
> Hi pakmannen,
> 
> You can have a look at this issue : 
> http://framework.zend.com/issues/browse/ZF-2128
> 
> -- 
> Laurent Melmoux - [EMAIL PROTECTED]
> 
> 
> 
> pakmannen a écrit :
>> Hi all,
>>
>> Have a question regarding Zend_Filter_Input and unknown fields.
>> Basically, I
>> have a form with, say, five fields. I want to apply a filter on all of
>> them,
>> but only need to validate two. I thought I could do something like this:
>>
>> $filters = array(
>> '*' => new Zend_Filter_Trim
>> );
>>
>> $validators = array(
>> 'field_1' => new Zend_Validator_NotEmpty,
>> 'field_3' => new Zend_Validator_NotEmpty
>> );
>>
>> $input = new Zend_Filter_Input($filters, $validators);
>>
>> However, only field_1 and field_3 exists in the result and are availible
>> for
>> escaping and has the filter applied, the other fields end up as
>> "unknown".
>> That is:
>>
>> $field_1 = $input->field_1; // Escaped and filtered
>> $field_2 = $input->field_2; // Empty
>> $field_3 = $input->field_3; // Escaped and filtered etc..
>>
>> Any way around this or have I just misunderstood how to use
>> Zend_Filter_Input? 
>>
>> Edit - messed up the formating..
>>   
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Filter_Input-and-unknown-fields-tf4821361s16154.html#a13824055
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Filter_Input and unknown fields

2007-11-16 Thread pakmannen

Hi all,

Have a question regarding Zend_Filter_Input and unknown fields. Basically, I
have a form with, say, five fields. I want to apply a filter on all of them,
but only need to validate two. I thought I could do something like this:

$filters = array(
'*' => new Zend_Filter_Trim
);

$validators = array(
'field_1' => new Zend_Validator_NotEmpty,
'field_3' => new Zend_Validator_NotEmoty
);

$input = new Zend_Filter_Input($filters, $validators);

However, only field_1 and field_3 exists in the result and are availible for
escaping with the filters (the other fields end up as "unknown") so:

$field_1 = $input->field_1; // Escaped 
$field_2 = $input->field_2; // Empty
$field_3 = $input->field_3; // Escaped etc..

Any way around this or have I just misunderstood how to use
Zend_Filter_Input? 

Edit - messed up the formating..
-- 
View this message in context: 
http://www.nabble.com/Zend_Filter_Input-and-unknown-fields-tf4821361s16154.html#a13793444
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Filter_Input and unknown fields

2007-11-16 Thread Laurent Melmoux

Hi pakmannen,

You can have a look at this issue : 
http://framework.zend.com/issues/browse/ZF-2128


--
Laurent Melmoux - [EMAIL PROTECTED]



pakmannen a écrit :

Hi all,

Have a question regarding Zend_Filter_Input and unknown fields. Basically, I
have a form with, say, five fields. I want to apply a filter on all of them,
but only need to validate two. I thought I could do something like this:

$filters = array(
'*' => new Zend_Filter_Trim
);

$validators = array(
'field_1' => new Zend_Validator_NotEmpty,
'field_3' => new Zend_Validator_NotEmpty
);

$input = new Zend_Filter_Input($filters, $validators);

However, only field_1 and field_3 exists in the result and are availible for
escaping and has the filter applied, the other fields end up as "unknown".
That is:

$field_1 = $input->field_1; // Escaped and filtered
$field_2 = $input->field_2; // Empty
$field_3 = $input->field_3; // Escaped and filtered etc..

Any way around this or have I just misunderstood how to use
Zend_Filter_Input? 


Edit - messed up the formating..