Same problem here.
It seems that $_POST is not populated and a print_r($this-
>get('request')) show no POST properties filled, whereas HTML form
seems valid.

On 11 fév, 18:17, Frenck <fre...@gmail.com> wrote:
> Hi,
>
> I've got a small little issue with Symfony2 PR6. I'm trying to create
> a small and simple form.
> Input is an barcode (entered by a barcode scanner).
>
> The form does not generate any error's.
> It's display, I can submit it, but nothing happens.
> I've added an simple else{} statement with an echo "INVALID" to check
> if validation passes.
>
> Whatever I do. Validation never passes, but no error's are printed :S
>
> Could someone please tell me what I'm doing wrong? It's driving me
> completely crazy :S
>
> Thanks in a million!
>
> This is (part) of my config.yml:
> =================================================
> app.config:
>   charset:        UTF-8
>   csrf_protection:
>     enabled:      true
>     secret:       secretkeykey
>   router:         { resource: "%kernel.root_dir%/config/routing.yml" }
>   validation:     { enabled: true, annotations: true }
>
> BarcodeRequest.php
> ===================================
> <?php
>   namespace MyBundle\Request;
>
>   class BarcodeRequest
>   {
>     /**
>      *
>      * @validation:MaxLength(15)
>      * @validation:NotBlank
>      * @validation:AssertType("integer")
>      */
>     protected $barcode;
>
>     public function setBarcode($barcode)
>     {
>       $this->barcode = $barcode;
>     }
>
>     public function getBarcode()
>     {
>       return $this->barcode;
>     }
>   }
>
> BarcodeForm.php
> ================================
> <?php
>
>   namespace MyBundle\Form;
>
>   use Symfony\Component\Form\Form;
>   use Symfony\Component\Form\TextField;
>
>   class BarcodeForm extends Form
>   {
>     protected function configure()
>     {
>       $this->add(new TextField('barcode'));
>     }
>    }
>
> (part of) My Template:
> ======================================
> <?php echo $view['form']->errors($form) ?>
>   <div>
>     <form href="#" method="POST" class="form label-inline">
>       <div class="field"><?php echo $view['form']->label($form['barcode']) 
> ?><?php echo $view['form']-
> >render($form['barcode'], array('class'=>'medium auto-focus')) ?></
>
> div>
>       <?php echo $view['form']->hidden($form) ?>
>     </form>
>   </div>
>
> My Controller:
> ======================================
> <?php
>   namespace MyBundle\Controller;
>
>   use Symfony\Bundle\FrameworkBundle\Controller\Controller;
>   use MyBundle\Form\BarcodeForm;
>   use MyBundle\Request\BarcodeRequest;
>
>   class ScanController extends Controller
>   {
>
>     public function indexAction()
>     {
>       $barcodeRequest = new BarcodeRequest();
>       $barcodeForm =  BarcodeForm::create($this->get('form.context'),
> 'scan');
>
>       $barcodeForm->bind($this->get('request'), $barcodeRequest);
>
>       if ($barcodeForm->isValid()) {
>         die($barcodeRequest->getBarcode());
>       } else {
>         echo "INVALID!";  //Extra echo.. .just for debugging/testing
>       }
>
>       return $this->render('MyBundle:Scan:index.html.php', array(
>           'form' => $barcodeForm,
>           ));
>     }
>   }

-- 
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