HTML <button> formnctypeคุณสมบัติ
ตัวอย่าง
แบบฟอร์มที่มีปุ่มส่งสองปุ่ม ปุ่มส่งปุ่มแรกส่งข้อมูลแบบฟอร์มด้วยการเข้ารหัสอักขระเริ่มต้น และปุ่มที่สองส่งข้อมูลแบบฟอร์มโดยไม่มีการเข้ารหัสอักขระ:
<form action="/action_page_binary.asp" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname" value="Ståle"><br><br>
<button type="submit">Submit with character encoding</button>
<button type="submit" formenctype="text/plain">Submit without character encoding</button>
</form>
ความหมายและการใช้งาน
แอตทริบิวต์formenctype
ระบุว่าควรเข้ารหัสข้อมูลแบบฟอร์มอย่างไรก่อนส่งไปยังเซิร์ฟเวอร์ แอตทริบิวต์นี้จะแทนที่แอตทริบิวต์ของแบบenctype
ฟอร์ม
คุณลักษณะformenctype
นี้ใช้สำหรับปุ่มที่มี
type="submit"
.
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่
Attribute | |||||
---|---|---|---|---|---|
formenctype | 9.0 | 10.0 | 4.0 | 5.1 | 11.5 |
ไวยากรณ์
<button type="submit" formenctype="value">
ค่าแอตทริบิวต์
Value | Description |
---|---|
application/x-www-form-urlencoded | Default. All characters will be encoded before sent |
multipart/form-data | This value is necessary if the user will upload a file through the form |
text/plain | Sends data without any encoding at all. Not recommended |
❮ แท็ก HTML <button>