Form Validation still submitting empty form


I have a form for user to fill in every field. The situation is, I have an input field that user will type in the name of person involved in the operation and the name will be listed in a textarea. I use "required" and "disabled" at textarea as I need to capture the data inserted by the user from the input field. But, when I try to submit an empty form, it still send empty value to the database.

<form name="prereport" action="insert_operation.php" method="POST">
  <div class="container">
    <div class="container-fluid">
      <input name="inputtitle" type="text" class="form-control" placeholder="Insert Operation Title" required>
      <br>
      <div class="input-group">
        <input name="inputname" type="text" class="form-control" placeholder="Insert Name of Person Going">
        <span class="input-group-btn">
          <button class="btn btn-default" type="button" onclick="addtext();">Add +</button>
        </span>
      </div>
      <br>
      <div class="output-group">
        <label for="comment">List of Person Going</label>
        <textarea name="outputname" class="form-control" rows="5" id="comment" required required></textarea>
      </div>
      <br>
      <div class="input-group">
        <input name="inputequip" type="text" class="form-control" placeholder="Insert Equipment to Bring for Operation">
        <span class="input-group-btn">
          <button class="btn btn-default" type="button" onclick="addequip();">Add +</button>
        </span>
      </div>
      <br>
      <div class="output-group">
        <label for="comment">List of equipments for operation</label>
        <textarea name="outputequip" class="form-control" rows="5" id="comment" required disabled></textarea>
      </div>
      <br>
      <br>
      <center>
        <button type="submit" class="btn btn-warning" id="check">Add</button>
      </center>
    </div>
  </div>
</form>

Picture of the form:

enter image description here


Answers:


What Quentin is trying to say is dat when a field has the property "disabled" the field won't be send with the form post.

Try using "readonly" instead of "disabled".

Key Differences

The Disabled attribute

Values for disabled form elements are not passed to the processor method. The W3C calls this a successful element.(This works similar to form check boxes that are not checked.) Some browsers may override or provide default styling for disabled form elements. (Gray out or emboss text) Internet Explorer 5.5 is particularly nasty about this. Disabled form elements do not receive focus. Disabled form elements are skipped in tabbing navigation.

The Read Only Attribute

Not all form elements have a readonly attribute. Most notable, the , , and elements do not have readonly attributes (although thy both have disabled attributes) Browsers provide no default overridden visual feedback that the form element is read only. (This can be a problem… see below.) Form elements with the readonly attribute set will get passed to the form processor. Read only form elements can receive the focus Read only form elements are included in tabbed navigation.