douxiluan6555 2014-02-05 02:04
浏览 45

Yii:保存表单模型返回404页面

I don't know what happened but at some point my form submission to save the model Students is failing. For example when I submit the form for a Student, it used to redirect to /student/33 which shows the student I just created but now it's showing 404 error. There's no error or stacktrace thrown.

How can I debug this situation? When I go to /student/22 it shows up fine. I think it must have been some change I made but can't figure out how to debug this. All I did was change the date format.

  • 写回答

1条回答 默认 最新

  • dqz84361326 2014-02-05 02:09
    关注

    Make sure the form action is pointing to the right url. Use the action key as part of the form -

    <?php $form=$this->beginWidget('CActiveForm', array(
            'id'=>'add-form',
            'action'=>$this->createUrl('site/student',array('id'=>$id)),
            'enableAjaxValidation'=>true,
            'enableClientValidation'=>false,
            'clientOptions'=>array(
              'validateOnSubmit'=>true,
              'validateOnChange'=>false,
              'validateOnType'=>true,
            ),
          )); ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探