Javascript 如何从jquery UI选项卡内容的下拉列表中获取所选项目的值
我正在使用jquery UI选项卡,我有文本字段和下拉列表来选择选项卡的内容,我从文本字段中获取值,但不是从下拉列表选择项中获取值,请任何人帮助我,我的项目在yii中Javascript 如何从jquery UI选项卡内容的下拉列表中获取所选项目的值,javascript,php,jquery,jquery-ui,yii,Javascript,Php,Jquery,Jquery Ui,Yii,我正在使用jquery UI选项卡,我有文本字段和下拉列表来选择选项卡的内容,我从文本字段中获取值,但不是从下拉列表选择项中获取值,请任何人帮助我,我的项目在yii中 <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Tabs - Vertical Tabs functionality</title> <link rel="styleshee
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Tabs - Vertical Tabs functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
$( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
});
</script>
<style>
.ui-tabs-vertical { width: 55em; }
.ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; width: 12em; }
.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
.ui-tabs-vertical .ui-tabs-nav li a { display:block; }
.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; }
.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right; width: 40em;}
</style>
</head>
<body>
<?php echo $model->name;?>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Nunc tincidunt</a></li>
<li><a href="#tabs-2">Basic Information</a></li>
<li><a href="#tabs-3">Report</a></li>
<li><a href="#tabs-4">Set schedule</li>
</ul>
<div id="tabs-1">
<h2>Content heading 1</h2>
<?php echo 'la la';?>
</div>
<div id="tabs-2">
<h2>Content heading 2</h2>
</div>
<div id="tabs-3">
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'message-form',
'htmlOptions'=>array('target'=>'_blank'),
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model_report_form);
?>
<table class="table">
<tr>
<td><?php
echo $form->labelEx($model,'month');
$months = array(
'01'=>'January',
'02'=>'February',
'03'=>'March',
'04'=>'April',
'05'=>'May',
'06'=>'June',
'07'=>'July',
'08'=>'August',
'09'=>'September',
'10'=>'October',
'11'=>'November',
'12'=>'December',
);
//$stat = array('13' => Yii::t('month','ALL'));
echo $form->dropdownlist($model_report_form,'month',$months,array('empty' => '--Select a month--'));
//echo $form->textField($model,'end_date');
?></td>
<td><?php echo $form->labelEx($model_report_form,'year');
$years = array(
'2016'=>'2016',
'2017'=>'2017',
'2018'=>'2018',
'2019'=>'2019',
'2020'=>'2020',
'2021'=>'2021',
'2022'=>'2022',
'2023'=>'2023',
'2024'=>'2024',
'2025'=>'2025',
);
//$stat = array('3000' => Yii::t('year','ALL'));
echo $form->dropdownlist($model_report_form,'year',$years,array('empty' => '--Select a year--'));
//echo $form->textField($model,'end_date');
?></td>
</tr>
<tr>
<?php echo $form->hiddenField($model_report_form, 'employee',array('value'=>$model->employee_id)); ?>
<?php echo $form->hiddenField($model_report_form, 'report_type',array('value'=>'1')); ?>
</tr>
</table>
<div class="row buttons">
<?php echo CHtml::submitButton('Get Report',array('class'=>'btn btn-primary btn-block')); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
您何时尝试获取该值?使用PHP提交表单后,请在提交表单的地方打印\u r$\u POST。你看到里面的下拉列表了吗?是的!我用过它,但是我没有得到任何关于slection的结果,我曾经用ajax解决过它,当然感谢你的时间,很高兴你解决了它。祝你周末愉快: