当前位置:网站首页>JS general form submission 1-onsubmit
JS general form submission 1-onsubmit
2022-07-03 13:54:00 【Cloud and cloud discoloration 1】
During form submission , If you directly click on the form submit Button will submit the form , But this method is not applicable when verification is needed .
Therefore, it usually happens in form In the statement of onsubmit Methods , Add fields to be verified in this method .
The method is as follows :
1、form Forms
<form id='form1' action='' method='' omsubmit='return checkForm()'>
<input type='text' name='username' value=''/>
<input type='password' name='pwd' value =''/>
<input type='password' name='pwd2' value =''/>
<button type='submit'> Submit <button/>
<form/>
2、 Statement onsubmit Method
<script>
function checkForm(){
var form = document.getElementById('form1');
// It can be modified here input
// Go to the next step
return true;
}
<script/>
3、 Submit Form
Triggered when the form is submitted checkForm, You can verify the password twice , You can also verify the validity of the user name , And if something goes wrong return fasle;, This will prevent the submission of the form .
It's just right onsubmit An attempt to , Then I will try to write general submit Method , And the use of ajax Method of submission , In this way, there is no way to refresh the submission form and ignore the form items to write the submission form .
above .
Refer to the connection :
https://www.cnblogs.com/web-wjg/p/7894657.html
边栏推荐
- Unity render streaming communicates with unity through JS
- 从零开始的基于百度大脑EasyData的多人协同数据标注
- 如何使用lxml判断网站公告是否更新
- Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe for the online account manager to open an account
- Spark practice 1: build spark operation environment in single node local mode
- pytorch 载入历史模型时更换gpu卡号,map_location设置
- 【被动收入如何挣个一百万】
- Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
- Box layout of Kivy tutorial BoxLayout arranges sub items in vertical or horizontal boxes (tutorial includes source code)
- Heap structure and heap sort heapify
猜你喜欢
Qt学习24 布局管理器(三)
Qt学习17 对话框及其类型
Error running 'application' in idea running: the solution of command line is too long
Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
CVPR 2022 | 美团技术团队精选6篇优秀论文解读
There is nothing new under the sun. Can the meta universe go higher?
从零开始的基于百度大脑EasyData的多人协同数据标注
Flutter dynamic | fair 2.5.0 new version features
随机推荐
Unity EmbeddedBrowser浏览器插件事件通讯
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
MySQL data processing value addition, deletion and modification
When updating mysql, the condition is a query
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered
又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
Multi person collaborative data annotation based on Baidu brain easydata from scratch
Qt学习22 布局管理器(一)
Golang - command line tool Cobra
Flutter dynamic | fair 2.5.0 new version features
SQL Injection (AJAX/JSON/jQuery)
SQL Injection (POST/Search)
如何使用lxml判断网站公告是否更新
挡不住了,国产芯片再度突进,部分环节已进到4nm
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update
Box layout of Kivy tutorial BoxLayout arranges sub items in vertical or horizontal boxes (tutorial includes source code)
记录关于银行回调post请求405 问题
Bidirectional linked list (we only need to pay attention to insert and delete functions)
SQL Injection (POST/Select)
logback日志的整理