[Solar-talk] validating forms using callbacks

Antti Holvikari anttih at gmail.com
Fri Jan 26 03:44:03 PST 2007


On 1/25/07, Rodrigo Moraes <rodrigo.moraes at gmail.com> wrote:
> I've been looking for an example of validating a form field using a
> callback, after some unsuccessful tries, and it seems to be something
> rare. Where should I pass the callback?
>
>         $callback = array($this, 'validateSubj');
>
>         $elements['area[subj]'] = array(
>             'type'    => 'text',
>             'label'   => $this->locale('LABEL_AREA_SUBJ'),
>             'require' => true,
>             'valid'   => array('callback', $callback),
>         );
>
> Sorry for the simple question. I couldn't find where the magic happens.

This works for me:

'valid' => array(array(
    'callback',
    'Feedback',
    $callback,
));


-- 
Antti Holvikari <http://phphalo.com>


More information about the solar-talk mailing list