启用 intl.so 扩展后表单上的 PHP 错误消息
这是我的控制器:
<?php
namespace Home\JoinBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Home\JoinBundle\Entity\User;
class DefaultController extends Controller
{
public function indexAction()
{
$user = new User;
$user->fname;
$user->lname;
$user->bday;
$form = $this->get('form.factory')
->createBuilder('form', $user)
->add('fname', 'text', array('label' => 'First Name: '))
->add('lname', 'text', array('label' => 'Last Name: '))
->add('bday', 'birthday', array('input' => 'array', 'widget' => 'choice'))
->getForm();
return $this->render('HomeJoinBundle:Default:index.html.twig', array('form' => $form->createView()));
}
}
Here is my controller:
<?php
namespace Home\JoinBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Home\JoinBundle\Entity\User;
class DefaultController extends Controller
{
public function indexAction()
{
$user = new User;
$user->fname;
$user->lname;
$user->bday;
$form = $this->get('form.factory')
->createBuilder('form', $user)
->add('fname', 'text', array('label' => 'First Name: '))
->add('lname', 'text', array('label' => 'Last Name: '))
->add('bday', 'birthday', array('input' => 'array', 'widget' => 'choice'))
->getForm();
return $this->render('HomeJoinBundle:Default:index.html.twig', array('form' => $form->createView()));
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
奇怪的是默认值不起作用,但尝试一下(默认情况下应该做同样的事情,如 http://symfony.com/doc/current/reference/forms/types/birthday.html
It's strange that the default value isn't working, but try this out (doing the same thing it should be doing by default as detailed in http://symfony.com/doc/current/reference/forms/types/birthday.html