Hi Mathew,

Thank you for the laboratory link to the prototype. I did an svn checkout
(rev: 155) and had a go with it.

Based on the test.php login scenario, I tried it in a simple ZF web
environment (see code below), and it worked nicely!

I'm still learning the prototype code and trying to guess how it will flesh
out but I wonder what happens next? I note multiple forms are intended but
is there a list of these best of bread ideas emerging? Perhaps a README.txt
might be appropriate?

Also, I wonder how does this prototype progress? Does it become yet another
proposal with perhaps all the other Zend_Form proposals somehow frozen to
help concentrate efforts?

Regards,
Mark


AuthController.php:

public function loginAction()
{
    $registry = Zend_Registry::getInstance();
    $helperPath = $registry['appDir'] .
Mm_Helper::portablePath('/library2/Zend/View/Helper');
    $this->view->addHelperPath($helperPath, 'Zend_View_Helper');
    $this->view->errors = false;

    $form = new LoginForm();
    $form->setView($this->view);

    $request = $this->getRequest();
    if ($request->getParam('login')) {
        $form->populate(array(
            'username'  => $request->getParam('username'),
            'password'  => $request->getParam('password'),
        ));
        if ($form->isValid()) {
            // user authenticated
            $this->_redirect('/');
        } else {
            $this->view->errors = true;
        }
    }

    $this->view->title = 'Login';
    $this->view->formAction = $this->view->baseUrl() . 'auth/login';
    $this->view->form = $form;
}


login.phtml:
Note. The submit appears to be in the LoginForm class now. Albeit I found
myself needing to add $this->getElement('login')->setValue('Login'); to make
the button read nicely.

<?=$this->render('header.phtml')?>
<h1><?=$this->title?></h1>
<?if ($this->errors):?>
<p>Errors were found in your input. Please see below for details.</p>
<?endif;?>

<form action="<?=$this->formAction?>" method="POST">
<?=$this->form->render()?>
</form>
<?=$this->render('footer.phtml')?>


Matthew Weier O'Phinney-3 wrote:
> 
> -- Mark Maynereid <[EMAIL PROTECTED]> wrote
> (on Friday, 30 November 2007, 07:35 AM -0800):
> It's in the laboratory:
> 
>     http://framework.zend.com/svn/laboratory/Zend_Form
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form-tf4719410s16154.html#a14137065
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to