Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony2中的jQuery日期选择器提供';此值无效。';_Jquery_Symfony_Jquery Ui Datepicker - Fatal编程技术网

Symfony2中的jQuery日期选择器提供';此值无效。';

Symfony2中的jQuery日期选择器提供';此值无效。';,jquery,symfony,jquery-ui-datepicker,Jquery,Symfony,Jquery Ui Datepicker,我在symfony2表单中添加了一个jQuery日期选择器 细枝文件: $('.date').datepicker({ showOn: 'button', buttonImageOnly: true, changeMonth: true, changeYear: true, dateFormat: 'yy-MM-dd ', yearRange: "-0:+1" }); PostType.php $builder->add('toD

我在symfony2表单中添加了一个jQuery日期选择器

细枝文件:

$('.date').datepicker({ 
    showOn: 'button', 
    buttonImageOnly: true, 
    changeMonth: true,
    changeYear: true,
    dateFormat: 'yy-MM-dd ',
    yearRange: "-0:+1"  
});
PostType.php

$builder->add('toDate','date',array(
    'widget' => 'single_text',
    'format' => 'dd-MM-yyyy',
    'attr' => array('class' => 'date')
 ))

我试过几种约会方式。但是我总是得到
这个值是无效的。
当我提交时。我试图获取表单错误,但它没有提供更多信息。

尝试类似的方法

$('.date').datepicker({ 
    showOn: 'button', 
    buttonImageOnly: true, 
    changeMonth: true,
    changeYear: true,
    dateFormat: 'dd-mm-yy',
    yearRange: "-0:+1"  
});
PostType.php

$builder->add('toDate','date',array(
    'widget' => 'single_text',
    'format' => 'dd-MM-yyyy',
    'attr' => array('class' => 'date')
 ))
我只是想说清楚

在jQuery UI中:

mm = "01"
MM = "January"
在Symfony:

mm // is not valid format
MM == "01"

Symfony MM与jQuery UI MM相同

太好了,它可以工作!有关于这个日期格式和jquery的文档吗?只是要指出,这篇文章太棒了!非常感谢Rajeshit,因为Symfony中的MM和jQuery UI中的MM返回相同的结果