私はすべてのフィールドを入力するフォームを持っています。状況は、私はユーザーが操作に関係する人の名前で入力する入力フィールドを持っており、名前はテキストエリアにリストされます。私は入力フィールドからユーザーが挿入したデータをキャプチャする必要があるため、テキストエリアで「必須」と「無効」を使用します。しかし、空のフォームを送信しようとすると、空の値がデータベースに送信されます。フォーム検証はまだ空のフォームを提出しています
<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>
形式の画像:
"私はtextareaで" required "と" disabled "を使用します。無効になっているフィールドでデータを送信する方法を尋ねていますか? – Quentin
私は読み取り専用に変更を無効にしました。私がreadonlyを使用するのは、テキストエリアを編集しないようにするためです。しかし、私は空のフォームを提出すると、まだテキストエリアからのデータなしでデータベースに挿入されます。 –
サファリを使用していますか?必須はSafariではサポートされていません。また、HTML5で導入されているので、ブラウザはHTML5をサポートする必要があります。 –