【问题标题】:CJuiAutoComplete submit selected valueCJuiAutoComplete 提交选中的值
【发布时间】:2014-01-20 15:20:42
【问题描述】:

我尝试从下拉列表中获取选定的值,但它只需要写入的值。 如何获取所选值?

$this->widget('zii.widgets.jui.CJuiAutoComplete',array(
    'id'        => 'autosuggest_name',
    'name'      => 'model',
    'options'   => array('minLength'=>'1'),

    'source'    => $this->createUrl("advertisements/autocompleteBoatModels"),

    'htmlOptions'=> array(
        'maxlength' => 30
    ),
    'options'   => array(
        'delay'     => 100,
        'showAnim'  => 'fold',
        'select'    => 'js:function(event,ui){
            $("#hmodel").val(ui.item.model_id);
            $(event.target.form).submit();
        }',
    ),
));

这个我试过了,还是不行

$("#hmodel").val(ui.item.model_id).submit

错误在哪里:) 谢谢

【问题讨论】:

    标签: php jquery yii


    【解决方案1】:

    进行 ajax 调用而不是提交

    'select'=>'js:function(event, ui) { 
               $.ajax({
               type:"POST",
               url: "/your/url",
               data: {selected:ui.item.id},
               success:function(data) {}
               });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-14
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      • 2014-06-26
      • 2018-01-15
      相关资源
      最近更新 更多