attajob

attajob

Till There was you

  • 财富值240
  • 威望值0
  • 总积分240

个人信息

  • 解决了,我把相应的model,module,view,controller删除后重新做了一遍就好了

  • 还有在这之上还用了一个datepicker,是不是datepicker影响到了js:this.value?

  • 我的ajax提交出问题了,报HTTP 500可能是什么原因啊,说是Jquery.js 7829行有问题,该行的内容为

    7826 // Do send the request
    7827 // This may raise an exception which is actually
    7828 // handled in jQuery.ajax (so no try/catch here)
    7829 xhr.send( ( s.hasContent && s.data ) || null );
    难道是Ajax中的data出问题了?

    'ajax'=>array(                                                                                             'url'=>Yii::app()->createUrl('Issue/issue/dynamicProjectNumber'),
        'data'=>array( 'machine_sn' => 'js:this.value'),
        'update'=>'#Issue_project_number',
    ),
    
  • 指向报错的地方是jquery.js的下面这段代码

    // Do send the request
    // This may raise an exception which is actually
    // handled in jQuery.ajax (so no try/catch here)
    xhr.send( ( s.hasContent && s.data ) || null );
    
  • PHP Error [2]

    include(cHtml.php) [function.include]: failed to open stream: No such file or directory (D:\xampp\htdocs\X\framework\YiiBase.php:421)

    #0 D:\xampp\htdocs\X\framework\YiiBase.php(421): CWebApplication->handleError()
    #1 D:\xampp\htdocs\X\framework\YiiBase.php(421): autoload()
    #2 unknown(0): autoload()
    #3 D:\xampp\htdocs\X\yii_fox\protected\models\Issue.php(111): spl_autoload_call()
    #4 D:\xampp\htdocs\X\yii_fox\protected\modules\Issue\controllers\IssueController.php(184): Issue->getProjectNumberList()
    #5 unknown(0): IssueController->actionDynamicProjectNumber()
    #6 D:\xampp\htdocs\X\framework\web\actions\CAction.php(104): ReflectionMethod->invokeArgs()
    #7 D:\xampp\htdocs\X\framework\web\actions\CInlineAction.php(48): CInlineAction->runWithParamsInternal()
    #8 D:\xampp\htdocs\X\framework\web\CController.php(300): CInlineAction->runWithParams()
    #9 D:\xampp\htdocs\X\framework\web\filters\CFilterChain.php(134): IssueController->runAction()
    #10 D:\xampp\htdocs\X\framework\web\filters\CFilter.php(41): CFilterChain->run()
    #11 D:\xampp\htdocs\X\framework\web\CController.php(1144): CAccessControlFilter->filter()
    #12 D:\xampp\htdocs\X\framework\web\filters\CInlineFilter.php(59): IssueController->filterAccessControl()
    #13 D:\xampp\htdocs\X\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter()
    #14 D:\xampp\htdocs\X\framework\web\CController.php(283): CFilterChain->run()
    #15 D:\xampp\htdocs\X\framework\web\CController.php(257): IssueController->runActionWithFilters()
    #16 D:\xampp\htdocs\X\framework\web\CWebApplication.php(277): IssueController->run()
    #17 D:\xampp\htdocs\X\framework\web\CWebApplication.php(136): CWebApplication->runController()
    #18 D:\xampp\htdocs\X\framework\base\CApplication.php(158): CWebApplication->processRequest()
    #19 D:\xampp\htdocs\X\yii_fox\index.php(13): CWebApplication->run()
    
  • 然后在跑的时候能够执行actionDynamicProjectNumber,但是不能通过,会报错[attach]581[/attach]

  • 老大帮我看看到底什么地方出问题了,我重新写过一遍你的DemoCity,细节都注意到,而且成功了。
    但是想把这个结构应用到我这里来的时候就出问题了,报错PHP500

    /*
     *  Give Dynamic Project Number List
     * 
     */
    public function actionDynamicProjectNumber($machine_sn)
    {
    //    $model=Machine::model()->getMachineSnList();
          $model = Issue::model()->getProjectNumberList($machine_sn);
    //    $model=Machine::model()->getMachineSnList1();               
             foreach($model as $value=>$name) 
             {
              echo CHtml::tag('option',array('value'=>$value),CHtml::encode($name),true);
                                         }
     }
    <!-- machine _ s n drop down list-->
    <div class="row">
    <?php echo $form->labelEx($model,'machine_sn'); ?>
    <?php 
         echo $form->dropDownList(
                       $model,
                       'machine_sn', 
                       Issue::model()->getMachineSnList(),
                       array(
                             'empty'=>'-请选择-',
                             'ajax'=>array(
                                  'url'=>Yii::app()->createUrl('Issue/issue/dynamicProjectNumber'),                                                      
    			      'data'=>array('machine_sn'=>'js:this.value'),
                                  'update'=>'#Issue_project_number',
                                   ),
                                 )
                              );                                                
                                        ?>
    <?php echo $form->error($model,'machine_sn'); ?>
    </div>
    array('allow',          // allow authenticated user to perform 'create' and 'update' actions
    	 'actions'=>array('create','update','dynamicProjectNumber'),
    	  'users'=>array('@'),
    			), 
    public function getMachineSnList () {
          $currMachineSnList=  Machine::model()->findAll();
          return cHtml::listData($currMachineSnList,'machine_sn','machine_sn');
           }
                     
     /*
      *  get Machine Project Number
      * 
      */
     public function getProjectNumberList ($machine_sn) {
           $currProjectNumber=  Machine::model()->findAllByAttributes(array('machine_sn'=>$machine_sn));
           return cHtml::listData($currProjectNumber,'machine_sn','project_number');
            }
    
  • 谢谢舰长,先好好看看,再来问问

  • 多谢舰长提醒,我看的就是这段代码,想改写,没改成功

  • 为什么贴出来排版这么奇怪呢?
    不管了,事情是这样的,这段代码是舰长在省份城市两级连动中的根据省份自动生成城市list的代码,用到了AJAX.我有以下几点不清楚,
    a. 如果是module Issue中IssueController中的函数actionDynamicProjectNumber,是否应该改写成'url'=>Yii::app()->createUrl('Issue/issue/dynamicProjectNumber'),
    b. 'update'=>'#Member_city',
    是什么含义啊?

见习主管 等级规则
240/500
资料完整度
40/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

0

Ta的访客

0