第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

form.submit() 將在表單內(nèi)觸發(fā) double

form.submit() 將在表單內(nèi)觸發(fā) double

倚天杖 2023-02-23 16:08:39
再會(huì),以下是我的jsp代碼:<s:form beanclass="c.c.i.c.app.profile.ui.ChangePasswordAction" method="post" name="form1"><!-- some others code here -->     <sx:row cssClass="button_row">          <sx:input name="updatePassword" image="submit"/>       </sx:row></s:form>這是我的jquery:<script type="text/javascript">$(':input[name=updatePassword]').click(function() {        var answerProceed = confirm("Do you wish to proceed with the changes?");        if( answerProceed ){            var form = $("form[name=form1]");            form.attr("action", '<s:url beanclass="c.c.i.c.app.profile.ui.ChangePasswordAction" event="update"/>');            form.submit();        } else {        return false;}    });</script>我們可以看到,在 jQuery 中,它會(huì)觸發(fā)一個(gè)update事件到ChangePasswordAction.但是,目前我有一個(gè)問題,就是有時(shí)候會(huì)觸發(fā)2次,不是每次都會(huì)發(fā)生,但是發(fā)生率在50%左右。以下是我從我的應(yīng)用程序日志中得到的觸發(fā)日志:2019-06-26 18:19:13.658 [WebContainer : 31] TRACE o.s.w.c.s.XmlWebApplicationContext - [bmaker] - Publishing event in Root WebApplicationContext: org.springframework.security.event.authorization.AuthorizedEvent[source=FilterInvocation: URL: /common/change_password.html?update=&__stoken=1a47d3a9-29e8-4904-b204-3cb9fc0129f0]2019-06-26 18:19:13.660 [WebContainer : 26] TRACE o.s.w.c.s.XmlWebApplicationContext - [bmaker] - Publishing event in Root WebApplicationContext: org.springframework.security.event.authorization.AuthorizedEvent[source=FilterInvocation: URL: /common/change_password.html?update=&__stoken=1a47d3a9-29e8-4904-b204-3cb9fc0129f0]任何人都知道代碼有什么問題?
查看完整描述

1 回答

?
MMTTMM

TA貢獻(xiàn)1869條經(jīng)驗(yàn) 獲得超4個(gè)贊

如果在提交表格之前要檢查確認(rèn),則必須使用表格中的<input/>is of 。在這種情況下,您可以在偵聽器中將 as 參數(shù)作為實(shí)現(xiàn)參數(shù)傳遞(由于單擊事件)。type="submit"preventDefault()eEventMouseEvent


例如 :


$(':input[name=updatePassword]').click(function(e) { // <-- e implements Event

? ? e.preventDefault(); // <-- prevent the submit of the form

? ? var answerProceed = confirm("Do you wish to proceed with the changes?");

? ? if (answerProceed) {

? ? ? ? var form = $("form[name=form1]");

? ? ? ? // var form = e.currentTarget.form; you can do this

? ? ? ? // var form = this.form; or you can do this, "this" is implicit clicked element

? ? ? ? form.attr("action", '<s:url beanclass="c.c.i.c.app.profile.ui.ChangePasswordAction" event="update"/>');

? ? ? ? form.submit();

? ? }

? ? else {

? ? ? ? return false;

? ? }

});

.form您可以通過對(duì)元素執(zhí)行操作來訪問元素的形式


查看完整回答
反對(duì) 回復(fù) 2023-02-23
  • 1 回答
  • 0 關(guān)注
  • 124 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)