-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
  • 331,213
  • 40
  • 305
  • 339
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190

1 Answers1

4

This field is not sent as it's disabled.

You should change it to readonly.

Regards

Pedram
  • 15,766
  • 10
  • 44
  • 73