Eduardo Fuerte
asked on
Could you point how to correctly positionate this icon at left side of this Bootstrap combobox?
Hi Experts
Could you point how to correctly positionate this icon at left side of this Bootstrap combobox?
It must appear in a similar way than the textbox.
Accordingly with:
Thanks in advance!
Could you point how to correctly positionate this icon at left side of this Bootstrap combobox?
It must appear in a similar way than the textbox.
Accordingly with:
<div class="row">
<div class="col-xs-12 mb15">
<!--label for="fk_seguradora" class="field-label text-muted mb10">Cliente Corporativo</label-->
<!--span class="input-group-addon "-->
<i class="fa fa-search c-gray"></i>
<!--/span-->
<label for="fk_seguradora" class="validar field select">
<?php echo $fk_seguradora; ?>
<i class="arrow double"></i>
</label>
</div>
</div>
Thanks in advance!
ASKER
Hi Julian
Your examle perfectly runs in my test.
But since this combobox is dynamically mounted:
It doesn't run correctly in this case:
This question is directly conected to that other (If you could have a look)
Your examle perfectly runs in my test.
But since this combobox is dynamically mounted:
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
<select class="selectpicker form-control">
<option>Selecione ...</option>
<option><?php echo $fk_seguradora; ?></option>
</select>
</div>
It doesn't run correctly in this case:
This question is directly conected to that other (If you could have a look)
I can't see why it won't work - are you saying that CI does not generate the right code?
ASKER
Codeigniter's Controller code relevant to combobox:
If I use this view code:
Runs this way:
But since the value must be a "selected", working the same way as this harded code:
My doubt is: what changes have to be done in CI Controller and View to have it working ....
(if possible with the icon left side)
public function index() {
// SELECT/DROPDOWN do Seguradora
$fk_seguradora = $this->cliente_corporativo_model->new_get(array('query' => 'select * from meeta_ike_relatorios.system_seguradora'));
$dropdown[0] = 'Selecione ...';
foreach ($fk_seguradora as $key => $value)
$dropdown[$value->id_seguradora] = $value->nome_seguradora;
$this->data['fk_seguradora'] = form_dropdown('fk_seguradora', $dropdown, '', 'id="id_seguradora"');
unset($dropdown);
If I use this view code:
<label for="fk_seguradora" class="validar field select">
<?php echo $fk_seguradora; ?>
<i class="arrow double"></i>
</label>
Runs this way:
But since the value must be a "selected", working the same way as this harded code:
<div class="col-xs-12 mb15">
<div class="input-group">
<span class="input-group-addon ">
<i class="fa fa-search c-gray"></i>
</span>
<span class="select">
<select id="fk_seguradora" name="fk_seguradora">
<option value="" selected="selected">...Cliente Corporativo...</option>
<option value="1">Ace</option>
<option value="2">Zurich</option>
<option value="3">Banco Safra</option>
<option value="4">SANTANDER</option>
...
</select>
</span>
</div>
</div>
My doubt is: what changes have to be done in CI Controller and View to have it working ....
(if possible with the icon left side)
I am still not with you. This code outputs a <label>
<label for="fk_seguradora" class="validar field select">
<?php echo $fk_seguradora; ?>
<i class="arrow double"></i>
</label>
Where is the <select> part?
ASKER
The presented Codeigniter's Controller perfectly mounts combo without select.
I'm trying to mount a combo - that must work in a similar way than the harded coded above, that uses select.
(it must to use select since the value must to be used in a filter)
I don't know if I'm going the right way by coding this in Controller:
Than in the view code something like this:
I'm trying to mount a combo - that must work in a similar way than the harded coded above, that uses select.
(it must to use select since the value must to be used in a filter)
I don't know if I'm going the right way by coding this in Controller:
$fk_seguradora_f= $this->cliente_corporativo_model->new_get(array('query' => 'select * from meeta_ike_relatorios.system_seguradora'));
$options = array();
foreach ($fk_segurdora_f as $key => $value){
$options[$value['id_seguradora']] = $value['fk_seguradora'];
}
$this->data['fk_seguradora_f'] = form_dropdown($dropdown, $options);
unset($dropdown);
Than in the view code something like this:
<div class="col-xs-12 mb15">
<div class="input-group">
<span class="input-group-addon ">
<i class="fa fa-search c-gray"></i>
</span>
<span class="select">
<select id="id_seguradora" name="fk_seguradora_f">
</select>
</span>
</div>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Julian
In the meanwhile I strugled a lot with this issue.
Controller's Code:
View Code:
The filter runs OK.
But I still don't know to correctly form the combo in the
Model code:
The filter perfectly runs (even the name doesn't appears):
So I guess this question is closer the solution... could you give your talent again?
In the meanwhile I strugled a lot with this issue.
Controller's Code:
public function index() {
...
$this->data['fk_seguradora_f'] = $this->seguradora_model->get_seguradoras();
View Code:
<div class="row">
<div class="col-xs-12 mb15">
<div class="input-group">
<span class="input-group-addon ">
<i class="fa fa-search c-gray"></i>
</span>
<span class="select">
<select id="fk_seguradora" name="fk_seguradora">
<?php
foreach($fk_seguradora_f as $each)
{
?>
<option value="<?=$each['id_seguradora']?>"><? echo '????'?></option>
<?php
}
?>
</select>
</span>
</div>
</div>
</div>
The filter runs OK.
But I still don't know to correctly form the combo in the
Model code:
function get_seguradoras($fk_seguradora_f=null )
{
$data_room_type = array();
$this->db->select('id_seguradora', 'nome_seguradora');
$this->db->from('system_seguradora');
$query = $this->db->get();
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
//----- How to obtain here id / name ????
$data_room_type[] = $row;
//-----------------------------------------------------
}
}
return $data_room_type;
}
}
The filter perfectly runs (even the name doesn't appears):
So I guess this question is closer the solution... could you give your talent again?
Still struggling to fill in the gaps but is it not as simple as
If you want a specific value selected then we would need to know where to get this value from - what determines what value is selected in the list?
<div class="row">
<div class="col-xs-12 mb15">
<div class="input-group">
<span class="input-group-addon ">
<i class="fa fa-search c-gray"></i>
</span>
<span class="select">
<select id="fk_seguradora" name="fk_seguradora">
<?php
foreach($fk_seguradora_f as $each)
{
?>
<option value="<?php echo $each['id_seguradora']?>"><?php echo $each['nome_seguradora'];?></option>
<?php
}
?>
</select>
</span>
</div>
</div>
</div>
If you want a specific value selected then we would need to know where to get this value from - what determines what value is selected in the list?
ASKER
Thanks for help.
Since this question had a derivation I decided to open another question.
Since this question had a derivation I decided to open another question.
ASKER
Just doing this:
Instead of:
Made it correctly runs.
<option value="<?=$each['id_seguradora']?>"> <?=$each['nome_seguradora']?></option>
Instead of:
<option value="<?php echo $each['id_seguradora']?>"><?php echo $each['nome_seguradora'];?></option>
Made it correctly runs.
That makes sense.
As a general rule avoid any and all implementations that make use of the "old" PHP short cut tags.
<?php echo
Is the only way you should be doing your outputs - never <?= ...
As a general rule avoid any and all implementations that make use of the "old" PHP short cut tags.
<?php echo
Is the only way you should be doing your outputs - never <?= ...
ASKER
Ok!
I followed your advice.
I followed your advice.
Open in new window
Working sample hereEDIT
NB: I changed to using GlyphIcons as that is what is supported on my server. Change to FontAwesome as required.