使Spring Web Flow与IE 7表单一起使用 [英] Getting Spring Web Flow to work with IE 7 forms

查看:102
本文介绍了使Spring Web Flow与IE 7表单一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是

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表单,上面有多个按钮,这些按钮都使用

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表单一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆