我正在使用Codeigniter和bootstrap theme开发应用程序。我可以恢复表单中的所有字段值,但不能恢复必须从组合框选择的值。 组合框代码是
<div class="form-line">
<select class="form-control show-tic" id="idepe">
<?php foreach ($epes->result() as $epe){ ?>
<option value="<?php echo $epe->idepe; ?>"><?php echo $epe->code ; ?></option>
<?php } ?>
</select>
</div>
浏览器上生成的代码为:
<div class="form-line focused">
<div class="btn-group bootstrap-select form-control show-tic"><button type="button" class="btn dropdown-toggle btn-default" data-toggle="dropdown" data-id="idepe" title="SONATRO Alger"><span class="filter-option pull-left">SONATRO Alger</span> <span class="bs-caret"><span class="caret"></span></span></button><div class="dropdown-menu open"><ul class="dropdown-menu inner" role="menu"><li data-original-index="0"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">ALDIPH Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="1"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">ALTRO Skikda</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="2"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SOTRAMO</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="3"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">ENPS Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="4"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SOTRAMEST</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="5"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">EPTP Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="6" class="selected"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SONATRO Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="7"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">EPTP Constantine</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="8"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SEROR Telmcen</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="9"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">ERTP Tebessa</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="10"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SERA Oran</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="11"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">ETR Bejaia</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="12"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SAPTA Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="13"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">GESI-TP Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="14"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">MEDITRAM Alger</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="15"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">SOTROB Oum Elbouaghi</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="16"><a tabindex="0" class="" style="" data-tokens="null"><span class="text">ENROS</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li></ul></div><select class="form-control show-tic" id="idepe" tabindex="-98">
<option value="1">ALDIPH Alger</option>
<option value="2">ALTRO Skikda</option>
<option value="3">SOTRAMO</option>
<option value="4">ENPS Alger</option>
<option value="5">SOTRAMEST</option>
<option value="6">EPTP Alger</option>
<option value="7">SONATRO Alger</option>
<option value="8">EPTP Constantine</option>
<option value="9">SEROR Telmcen</option>
<option value="10">ERTP Tebessa</option>
<option value="11">SERA Oran</option>
<option value="12">ETR Bejaia</option>
<option value="13">SAPTA Alger</option>
<option value="14">GESI-TP Alger</option>
<option value="15">MEDITRAM Alger</option>
<option value="16">SOTROB Oum Elbouaghi</option>
<option value="17">ENROS</option>
</select></div>
</div>
并且在浏览器上生成的代码更长
答案 0 :(得分:0)
我想通了,您不仅要给id给出选择组合框的名称。 看起来应该是这样
<select class="form-control show-tic" name="idepe" id="idepe">