0
I use the following Function:
public function autoCompleteCilindro($q){
$this->db->select('*');
$this->db->limit(5);
$this->db->like('passo', $q);
$query = $this->db->get('cilindros');
if($query->num_rows() > 0){
foreach ($query->result_array() as $row){
$row_set[] = array('label'=>'Impressora: '.$row['impressora'].' | Cilindro: '.$row['engrenagens'].' | Passo: '.$row['passo'].' | Quantidade: '.$row['quantidade'],'quantidade'=>$row['quantidade'],'id'=>$row['idCilindro'],'engrenagens'=>$row['engrenagens']);
}
echo json_encode($row_set);
}
}
I type the approximate value of a step, 200 for example and I am presented the fields of the table "cylinders".
This I do in an input field.
I need to pass to the "height" field the result of dividing the "step" field divided by the "quantity field.
<div class="span6" style="margin-left: 0">
<label for="impressora">Impressora | Engrenagem | Passo | Quantidade de Cilindros<span class="required"></span></label>
<input name="impressora" id="impressora" class="span12" type="text" value="" />
</div>
<div class="span3">
<label for="altura">Altura</label>
<input name="altura" id="altura" readonly class="span12" type="text" value="" />
</div>
<div class="span3">
<label for="quantidade">Quantidade</label>
<input name="quantidade" id="quantidade" class="span12" type="text" value="" />
</div>
This will be done by Ajax?
– Sam
I believe so, yes. Within a Models file structure, it has a file that has the two public Function funtions add and public Function add().
– Júlio Ricardo
"Do you believe"? You are not the developer of the parade? Apparently, Ajax returns a JSON. Just divide one value by the other and play in the desired field.
– Sam