0
I have a select field with a list of names, after selecting one of them I have to assign a value in the database to an input field.
0
I have a select field with a list of names, after selecting one of them I have to assign a value in the database to an input field.
1
From what I understand you want to catch the value
of your field select
and play for a field input
if it’s not that, comment that I edit the answer to suit better
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).on('change', '.get-placa', function () {
var value = $(this).val();
$('.close').trigger('click');
$('.campo2').val(value);
});
</script>
<div class="col-lg-3">
<select class="form-control get-placa" type="text" name="campo1" maxlength='4'>
<option></option>
<option value='Campo1'>Campo1</option>
<option value='Campo2'>Campo2</option>
</select>
</div>
<div class="col-lg-3">
<label for="ex1">Pegando Value do Select:</label>
<input type="text" class="form-control campo2" maxlength="14" name="campo2"><br><!-- Input CNPJ -->
</div>
take the value of your select field and play for an input field, that’s right...!
Browser other questions tagged php javascript html
You are not signed in. Login or sign up in order to post.
jquery
orvanilla
even?– RFL
"assign a bank value to an input field" - you can explain that part better?
– Sergio
you have to assign the value that was selected in the select field to input as well ? That’s it ?
– Victor
Yes. I have to sweep the bank (select * from bank')
– alexjosesilva
in the input field I have to assign this value!
– alexjosesilva
Good if it is as I think, with javascript this is solved, because as you select the value within select it fills the input field you need with that respective value
– Victor
some example, step-by-step or case study ?
– alexjosesilva
I created an answer to this, if you attend me a feedback marking as best response
– Victor
Let’s go continue this discussion in chat.
– Victor
You want to search by name or by some name code?
– Sam
See if this link helps: https://answall.com/q/14646/66203
– UzumakiArtanis