2
I have a option and two inputs to feed according to the result of select.
In the select the user is chosen and in both inputs the address and email of the selected user are entered.
I wonder if it is possible to have 2 values possible to feed the inputs.
My current code is this:
<script type="text/javascript">
$(document).on('change', '.get-placa', function () {
var value = $(this).val();
$('.close').trigger('click');
$('.nome').val(value);
$('.email').val("<?php echo $row['email'];?>");
});
<div class="control-group col1">
<label class="control-label"><?php echo get_phrase('patient');?></label>
<div class="controls">
<select class="form-control get-placa chzn-select" type="text" name="patient_id">
<option value="">select</option>
<?php
$patients = $this->db->get('patient')->result_array();
foreach($patients as $row):
?>
<option value="<?php echo $row['address'];?>"><?php echo $row['name'];?></option>
<?php
endforeach;
?>
</select>
</div>
</div>
<div class="control-group col1">
<label class="control-label"><?php echo get_phrase('endereço');?></label>
<div class="controls">
<input readonly="true" type="text" class="form-control nome" name="nome">
</div>
</div>
<div class="control-group col1">
<label class="control-label"><?php echo get_phrase('email');?></label>
<div class="controls">
<input readonly="true" type="text" class="form-control email" name="email">
</div>
</div>
</script>
Thank you so much! That’s exactly what I didn’t know how to do. Thanks!!
– Lorena