使Spring Web Flow与IE 7表单一起使用

编程入门 行业动态 更新时间:2024-10-26 16:30:00
本文介绍了使Spring Web Flow与IE 7表单一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是这个问题,在对Spring Web Flow进行了一些调试并在Spring Web Flow中处理了事件之后,重新关注了.

This is a continuation of this question, refocused after some debugging on Spring Web Flow and the processing of events in Spring Web Flow.

我在Spring Web Flow和Internet Explorer 7以及IE 11的兼容模式"下遇到了问题.我已经验证了此问题,只是不知道如何解决.

I've got a problem with Spring Web Flow and Internet Explorer 7, and also IE 11 in "compatibility mode." I've verified this problem, I just don't know how to fix it.

我有一个Web Flow表单,上面有多个按钮,这些按钮都使用 JavaScript onclick()处理程序,因为它们都是type='button'而不是type='submit':

I have a Web Flow form with multiple buttons on it which are all wired using a Javascript onclick() handler because they're all type='button' and not type='submit':

<button id="addCurrentAccount" name="_eventId_addCurrentAccount" type="button" value="addCurrentAccount" class="buttonActivity add"> <span>Add Current Account</span> </button>

这是应该发生的情况::根据所单击的按钮,提交表单时会触发不同的Web Flow事件.例如,标记为删除帐户"的按钮应触发一个名为"_eventId_deleteAccount"的事件.标有创建帐户"的按钮应触发一个名为"_eventId_createAccount"的事件.

This is what is supposed to happen: Depending on the button that is clicked, different Web Flow events are fired when the form is submitted. For example, a button marked "Delete Account" should fire an event named "_eventId_deleteAccount". A button marked "Create Account" should fire an event named "_eventId_createAccount".

这适用于IE 8至11,Chrome和Firefox.但是,在IE 7和IE 11上的兼容模式"下,页面上的每个按钮与表单一起提交.这意味着该表单带有几个"_eventId_xxx"请求参数,并且由于第一个始终是"_eventId_createAccount",因此页面上的每个按钮都会在表单上创建另一个帐户.

This works on IE 8 through 11, Chrome and Firefox. However, on IE 7 and on IE 11 in "compatibility mode", every button on the page is submitted along with the form. This means that the form comes in with several "_eventId_xxx" request parameters, and since the first one is always "_eventId_createAccount", every button on the page creates another account on the form.

有没有简单的解决方法? (而且,不幸的是,不使用Web Flow"或不使用IE 7"不是选项.)

Is there a simple fix for this? (And, no, "don't use Web Flow" or "don't use IE 7" are not options, unfortunately.)

推荐答案

尝试通过在javascript函数中专门将eventId指定为:

Try by specifying the eventId exclusively in javascript function as:

function includeEvent(eventId){ document.getElementById("yourForm")._eventId.value = eventId; document.getElementById("yourForm").submit(); }

包含_eventId作为隐藏类型:

Include _eventId as hidden type:

<input type="hidden" name="_eventId" value="Continue"/> <button id="addCurrentAccount" name="addCurrentAccount" type="button" value="addCurrentAccount" class="buttonActivity add" onclick="javascript:includeEvent('addCurrentAccount')"> <span>Add Current Account</span> </button>

这样,您可以确保当用户单击Enter按钮时,会生成默认的继续"事件,您需要自定义该事件的处理方式.根据所提供的每次按钮单击,由提到的javascript函数设置相应的事件(请参见将此作为参数传递给javascript函数).

This way you can make sure that when user clicks on enter button a default "Continue" event is generated which you need to customize as to how to handle it. Based on each provided button click, respective event(see passing this as parameter to javascript function) is set by the javascript function mentioned.

更多推荐

使Spring Web Flow与IE 7表单一起使用

本文发布于:2023-10-09 18:02:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1476395.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   Spring   Web   Flow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!