Hi thanks for your replies both of you!
Bill: Yes, It just seems a bit weird to add validation rules for
something that I don't plan on validating in code.
I.e text area, check box.
Brian: Thanks a lot!
This seems to do the trick, I was looking for a validation class I
could use for all fields.
Regards,
Bjarte
Brian Caspe wrote:
I solved this in my app by putting a validator (for those fields which
didn't need their own validation):
'*' => 'notEmpty',
array('field','names','here')
and then you can set an option for the input filter to allow for not
empty fields or flag the '*' as allowing no values.
brian
On 7/16/07, Bill Karwin <[EMAIL PROTECTED]> wrote:
The design of Zend_Filter_Input assumes that you do know the fields
that you are processing, and you should only use data that has been
both filtered and validated. Therefore one probably should never use
the getUnknown() method at all, except to detect inconsistencies
between the form input and the validation code (i.e. someone added a
field to the HTML form without adding it to the validation routine).
Regards,
Bill Karwin
> -----Original Message-----
> From: Bjarte Kalstveit Vebjørnsen [mailto:[EMAIL PROTECTED]
> Sent: Sunday, July 15, 2007 3:03 PM
> To: [email protected]
> Subject: Re: [fw-general] Re: Zend_Filter_Input and accessing
> values that is not validated
>
> Hi, and thanks for your reply.
>
> I find it odd though that the values that I supply to ZFI
> aren't available to me unless I validate them. Since I use
> ZFI so I don't have to mess around with the $_POST array.
> Using additional filter classes just to get filtered values
> seems messy, especially when you have lots of values.
>
> Oh well, thanks for clearing that up :-).
>
> Bjarte
>
>
> Joshua Ross wrote:
> > I believe Zend_Filter_Input::getUnknown() would return the
> raw value
> > but it will not be filtered. I think that is contrary to
> the idea of
> > ZFI where a value must first be valid before it is filtered and
> > returned. If you just need to just filter the value then
> > instantiating an instance of that particular filter is
> probably what
> > you want.
> >
> > Josh
> >
> > "Bjarte Kalstveit Vebjørnsen" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> Hi all.
> >>
> >> I am having troubles with the new Zend_Filter_Input.
> >> It is quite possible that I've missed something obvious,
> but here is
> >> my problem.
> >>
> >> <?php
> >> require_once 'Zend/Filter/Input.php'; $values = array(
> >> 'test' => '22',
> >> 'test2' => '22'
> >> );
> >>
> >> $filters = array('*'=> 'Digits');
> >>
> >> $validators = array('test2' => 'Digits');
> >>
> >> $input = new Zend_Filter_Input($filters, $validators, $values);
> >>
> >> echo "<pre>";
> >> var_dump($input->test);
> >> var_dump($input->test2);
> >> echo "</pre>";
> >> ?>
> >>
> >> This gives me:
> >>
> >> NULL
> >> string(2) "22"
> >>
> >>
> >> How can I access the filtered value of test, without adding a
> >> validator for it?
> >> (If I add test to the list of validators, it works).
> >>
> >> Best regards,
> >>
> >> Bjarte
> >>
> >
> >
> >
>
>