Hello, thx for the answer, here is the action

<?php

/* azione aggiunta da GF */

class contactAction extends sfAction {

    public function execute($request) {


// Define the form
        $this->form = new sfForm();
        $this->form->setWidgets(array(
            'name' => new sfWidgetFormInputText(),
            'email' => new sfWidgetFormInput(array('default' =>
                'm...@example.com')),
            'subject' => new sfWidgetFormChoice(array('choices' =>
array('Subject
A', 'Subject B', 'Subject C'))),
            'message' => new sfWidgetFormTextarea(),
        ));
        $this->form->setValidators(array(
            'name' => new sfValidatorString(),
            'email' => new sfValidatorEmail(),
            'subject' => new sfValidatorString(),
            'message' => new sfValidatorString(array('min_length' =>
4))

        ));
// Deal with the request
        if ($request->isMethod('post')) {

            $this->form->bind($request->getParameter('contact'));
            if ($this->form->isValid()) {
// Handle the form submission
                $contact = $this->form->getValues();
// Or to get a specific value
                $name = $this->form->getValue('name');
// Do stuff
// ...
                $this->redirect('investigator/index');
            }
        }
    }

}

........................and here is the template for success:

<form action="<?php echo url_for('investigator/contact') ?>"
method="post">
    <table>
        <?php echo $sf_user->getFlash('notice') ?>
        <?php echo $form ?>
        <tr>
            <td colspan="2">
                <input type="submit" value="Change" />
            </td>
        </tr>
    </table>
</form>


........................................................................................
On Dec 10, 5:17 pm, Flukey <jstevenh...@gmail.com> wrote:
> Can you post your action code please? Thanks
>
> On Dec 9, 2:55 pm, gfranzini <gabriele.franz...@nervianoms.com> wrote:
>
>
>
> > Hello,
> > I am experimenting with symfony 1.4.8/Doctrine. I have started
> > entering examples from the "Gentle Introduction", and have set up the
> > "contact" action as in page 171 of the book, and the template as in
> > page 160, listing 10.2.
>
> > Using Apache 2.2.17 as web server, on Windows.
>
> > When I test the form, no matter what I type in the fields, they are
> > always re-displayed as empty and marked as "Required".
> > The values appear to be correct in the Request:
>
> > parameterHolder:
> >   action: contact
> >   email: aaaaaaa
> >   message: aaaa
> >   module: investigator
> >   name: aaaaaaa
> >   subject: '0'
>
> > Thank you in advance for the help - must be a typical newbie problem
> > but I could not find how to solve...
> > Gabriele Franzini - Milano Italy- Hide quoted text -
>
> - Show quoted text -

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to