How to get the value of an input with getParameter?

Asked

Viewed 955 times

0

I’m not getting the value of the following input.

<input type="text" name="rua" class="form-control" id="rua" 
                                        placeholder="Rua/Av/Estrada" disabled required>

This field it is filled through a webservice. That is a post office service "Viacep".

Only during the registration of this input, I’m not able to take the value that the service puts in it.

I’m using the getParameter.

String pEndereco = request.getParameter("rua");

The code passes on this line and returns null.

1 answer

3


Inputs containing the attribute disabled are not sent together with the form data.

Remove the attribute disabled and just let readonly (read only) that will work.

It is worth remembering that not always the webservice will have all values or some may be outdated, so I think you should allow the field change.

  • Thank you @Diego Schmidt, it worked. This issue of the webservice does not always work, I will validate with my client, if it is his will I leave released.

  • @Kennedyanderson It may be a new address that is not yet in the post office or outdated, on the website of the webservice says it may have some outdated. abss

Browser other questions tagged

You are not signed in. Login or sign up in order to post.