-4

I have the following form:

<form class="form-horizontal" role="form" action="/updatedetails" method="POST">
  <input type="hidden" name="_csrf" value="{{_csrfToken}}">
  <div class="form-group">
    <label for="fieldUsername" class="col-sm-2 control-label">Username:</label>
    <div class="col-sm-4">
      <input type="text" disabled class="form-control" id="fieldUsername" name="username">
    </div>
  </div>
  <!-- more content -->

The value of the username input text field is set by jQuery during page load:

$('#fieldUsername').val(username);

The jQuery seems to work, as I can see the username field into the text field although it is disabled.

My question is, when I post the form why is the username not included in the request body ? All the fields are included. Does it mean that disabled fields are not included in the request body ?

Rory McCrossan
  • 319,460
  • 37
  • 290
  • 318
Rahul Iyer
  • 19,122
  • 17
  • 87
  • 180

1 Answers1

4

This field is not sent as it's disabled.

You should change it to readonly.

Regards

Pedram
  • 14,199
  • 8
  • 38
  • 69