1
I am with following problem: The user will complete the zip code and will click 'search zip'.
A search will be made for the zip code, and the data will be placed in the fields: patio, neighborhood, etc., automatically.
It turns out that I do not want the user to change this information that was generated automatically.
Try already readonly
and I did not succeed, because the fields already appear as inactive.
I wonder if there’s a way to do this kind of treatment.
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" for="logradouro">Logradouro</label>
<div class="col-md-7">
<input id="logradouro" name="logradouro" placeholder="" class="form-control input-md" required="required" type="text" readonly>
</div>
</div>
Thank you.
It has to be an input? why not put it in a div?
– Sergio
What code do you have so far?
– PauloHDSousa
There are cases where the zip code does not have the address, when it is small town, so the user will have to enter the address, I suggest validate this need in your application.
– Pedro Camara Junior
Throw the data from the backyard into a div, if you want to send this data to the server, put it in the div and in a Hidden field.
– RBoschini
I put inpu html in question.
– Thiago Ferreira
on the return of your function if it is different from null, you disable the fields.
– durtto
shows its function searching for the zip
– durtto
If you put this in a way that doesn’t change, you’re going to have problems. The zip code is full of things with problems. In fact, my zip code itself shows a street that is not mine on the major sites that use the post office pay base. As @Pedrocamarajunior said, predict the need to edit.
– Bacco
Very well noted by @Bacco. I have this function in my system, but always leave enabled for editing.
– durtto
then durtto, that’s what I wanted, the person type the zip code, click the search button and automatically appears in the fields the information. in your case appears inactive the information and the user has the change zip button?
– Thiago Ferreira