Javascript 表单提交未保存在Firefox上
我有一个项目,当我使用Chrome或IE时,它保存得很好,但当我使用Firefox时,当我提交表单时,它似乎停止工作。我使用SchedulesController调用edit_成员,并使用JsHelper调用另一个操作edit_测试。在edit_测试中,我使用JsHelper提交表单 编辑成员视图文件:Javascript 表单提交未保存在Firefox上,javascript,jquery,forms,cakephp,Javascript,Jquery,Forms,Cakephp,我有一个项目,当我使用Chrome或IE时,它保存得很好,但当我使用Firefox时,当我提交表单时,它似乎停止工作。我使用SchedulesController调用edit_成员,并使用JsHelper调用另一个操作edit_测试。在edit_测试中,我使用JsHelper提交表单 编辑成员视图文件: echo $this->Form->create('Schedule', array('id'=>"ScheduleEditMemberForm", 'action' =>
echo $this->Form->create('Schedule', array('id'=>"ScheduleEditMemberForm", 'action' => 'edit_member',$id,'default' => false));
$data = $this->Js->get("#ScheduleEditMemberForm")->serializeForm(array('isForm' => true, 'inline' => true));
$this->Js->get("#ScheduleEditMemberForm")->event(
'submit',
$this->Js->request(
array('action' => 'edit_test',$id,$userId),
array(
'update' => '#s',
'data' => $data,
'async' => true,
'dataExpression'=>true,
'method' => 'POST',
)
)
);
echo $this->Form->input('dates',
array(
'id'=>'datepicker',
'type'=>'text',
'label' => 'Work Date',
));
echo $this->Form->end('Start');
echo $this->Js->writeBuffer();
编辑测试
$data = $this->Js->get("#ScheduleEditTestForm")->serializeForm(array('isForm' => true, 'inline' => true));
$this->Js->get("#ScheduleEditTestForm")->event(
'submit',
$this->Js->request(
array('action' => 'compute',$id,$userId),
array(
'update' => '#s',
'data' => $data,
'async' => true,
'dataExpression'=>true,
'method' => 'POST',
'div' => false
)
)
);
echo $this->Form->create('Schedule', array('action' => 'edit_test',$id,$userId));
在edit_测试中,我调用compute操作将数据保存到数据库中,但我不知道为什么在使用Firefox时它不能保存数据。我还在我的视图文件中添加了以下内容:
echo $this->Form->create('Schedule', array('id'=>"ScheduleEditMemberForm", 'action' => 'edit_member',$id,'default' => false));
$data = $this->Js->get("#ScheduleEditMemberForm")->serializeForm(array('isForm' => true, 'inline' => true));
$this->Js->get("#ScheduleEditMemberForm")->event(
'submit',
$this->Js->request(
array('action' => 'edit_test',$id,$userId),
array(
'update' => '#s',
'data' => $data,
'async' => true,
'dataExpression'=>true,
'method' => 'POST',
)
)
);
echo $this->Form->input('dates',
array(
'id'=>'datepicker',
'type'=>'text',
'label' => 'Work Date',
));
echo $this->Form->end('Start');
echo $this->Js->writeBuffer();
我希望有人知道这种情况,并能帮助我
CakePHP 2。从Firebug得到任何反馈?Firebug给出了什么样的反馈?对不起,我对萤火虫不熟悉。。我的错误可能是我在创建的div上放置表单的方式吗?从我所看到的,您的代码在创建表单之后创建了一个ajax请求。您提到它可以在其他浏览器上使用,而在FireFox中则不行——看到Javascript的任何反馈都是非常有益的,仅此而已!我认为最好也把从助手生成的脚本放进去。这不应该是cakePHP问题,而是JS问题。JS helper仅仅是从helper创建javascript。这是来自firebug的,在控制台下的response。