帮助:[RETURN]键不提交表单(ASP.NET 2.0) [英] HELP: [RETURN] key is not submitting form (ASP.NET 2.0)

查看:58
本文介绍了帮助:[RETURN]键不提交表单(ASP.NET 2.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




尝试使用[RETURN]键提交ASPX表格(使用IE6)页面未在我的网站项目中提交。

尝试调试页面的'JavaScript代码我注意到有一些ASP.NET客户端脚本代码被执行有一个缺陷:


函数anonymous() {

if(!ValidatedTextBoxOnKeyPress(event)){event.cancelBubble = true; if(event.stopPropagation)event.stopPropagation();返回false; }

}


在这段代码中,并非所有路径都返回一个值!所以我的猜测是IE使用一个随机值来考虑是否提交表单。


如果这是真的那么我猜ASP.NET中有一个错误阻止我从实现我的客户的要求。


任何想法?


TIA,

Axel Dahmen

Hi,

trying to submit an ASPX form using the [RETURN] key (using IE6) the page is not submitted in my web project.

Trying to debug the pages'' JavaScript code I noticed that there''s some ASP.NET client script code being executed having a flaw:

function anonymous() {
if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; }
}

In this code, not all paths return a value! So my guess is that a random value is used by IE to consider whether to submit the form.

If this is true then I guess there''s a bug in ASP.NET blocking me from implementing my customer''s requirements.

Any ideas?

TIA,
Axel Dahmen

推荐答案

代码没有任何问题。如果没有验证,则返回void
需要
或验证是否正确;如果验证失败,则返回false(并且对于事件取消中的6个bug,也会返回
a hack),是浏览器想要的。


如果你看起来asp.net有默认按钮支持(哪个按钮开启

输入)。看小组控制。


- 布鲁斯(sqlwork.com)


Axel Dahmen写道:
there is nothing wrong with the code. it returns void if no validtion is
required or validation is ok, or false if validation fails (and also as
a hack for an ie 6 bug in event canceling), which is what the browser wants.

if you look asp.net has default button support (which button to fire on
enter). see panel control.

-- bruce (sqlwork.com)

Axel Dahmen wrote:




尝试使用[RETURN]键提交ASPX表格(使用IE6)页面未在我的网站项目中提交。


试图调试页面的'JavaScript代码我注意到有一些ASP.NET客户端脚本代码被执行有一个缺陷:


函数anonymous(){

if(!ValidatedTextBoxOnKeyPress(event)){event.cancelBubble = true; if(event.stopPropagation)event.stopPropagation();返回false; }

}


在这段代码中,并非所有路径都返回一个值!所以我的猜测是IE使用一个随机值来考虑是否提交表单。


如果这是真的那么我猜ASP.NET中有一个错误阻止我从实现我的客户的要求。


任何想法?


TIA,

Axel Dahmen
Hi,

trying to submit an ASPX form using the [RETURN] key (using IE6) the page is not submitted in my web project.

Trying to debug the pages'' JavaScript code I noticed that there''s some ASP.NET client script code being executed having a flaw:

function anonymous() {
if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; }
}

In this code, not all paths return a value! So my guess is that a random value is used by IE to consider whether to submit the form.

If this is true then I guess there''s a bug in ASP.NET blocking me from implementing my customer''s requirements.

Any ideas?

TIA,
Axel Dahmen


我明白了......不知道无效是合法的回报价值。


似乎是脚本调试器没有单步执行动态生成的代码(new Function(){...})。在那种情况下,我现在知道在哪里搜索...


谢谢,布鲁斯!


问候,

Axel


-----------

" bruce barker" < no **** @ nospam.comschrieb im Newsbeitrag news:OQ ************** @ TK2MSFTNGP04.phx.gbl ...
I see... Didn''t know void was a legal return value.

It seems the script debugger doesn''t step through dynamically generated code (new Function(){...}). In that case I now know where to search now...

Thanks, Bruce!

Regards,
Axel

-----------
"bruce barker" <no****@nospam.comschrieb im Newsbeitrag news:OQ**************@TK2MSFTNGP04.phx.gbl...

代码没有任何问题。如果没有验证,则返回void
需要
或验证是否正确;如果验证失败,则返回false(并且对于事件取消中的6个bug,也会返回
a hack),是浏览器想要的。


如果你看起来asp.net有默认按钮支持(哪个按钮开启

输入)。看小组控制。


- 布鲁斯(sqlwork.com)


Axel Dahmen写道:
there is nothing wrong with the code. it returns void if no validtion is
required or validation is ok, or false if validation fails (and also as
a hack for an ie 6 bug in event canceling), which is what the browser wants.

if you look asp.net has default button support (which button to fire on
enter). see panel control.

-- bruce (sqlwork.com)

Axel Dahmen wrote:




尝试使用[RETURN]键提交ASPX表格(使用IE6)页面未在我的网站项目中提交。


试图调试页面的'JavaScript代码我注意到有一些ASP.NET客户端脚本代码被执行有一个缺陷:


函数anonymous(){

if(!ValidatedTextBoxOnKeyPress(event)){event.cancelBubble = true; if(event.stopPropagation)event.stopPropagation();返回false; }

}


在这段代码中,并非所有路径都返回一个值!所以我的猜测是IE使用一个随机值来考虑是否提交表单。


如果这是真的那么我猜ASP.NET中有一个错误阻止我从实现我的客户的要求。


任何想法?


TIA,

Axel Dahmen
Hi,

trying to submit an ASPX form using the [RETURN] key (using IE6) the page is not submitted in my web project.

Trying to debug the pages'' JavaScript code I noticed that there''s some ASP.NET client script code being executed having a flaw:

function anonymous() {
if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; }
}

In this code, not all paths return a value! So my guess is that a random value is used by IE to consider whether to submit the form.

If this is true then I guess there''s a bug in ASP.NET blocking me from implementing my customer''s requirements.

Any ideas?

TIA,
Axel Dahmen


你好Alex,


HtmlForm和Panel都有一个名为DefaultButton的属性可以

允许您在按下ENTER键时指定默认按钮:


< form id =" form1" defaultbutton = QUOT; Button1的" runat =" server">

< div>

< asp:Button ID =" Button1" RUNAT = QUOT;服务器" OnClick =" Button1_Click"

Text =" Button" />

< asp:TextBox ID =" TextBox3" runat =" server">< / asp:TextBox>

< asp:Panel ID =" Panel1" DefaultButton = QUOT;将Button2" runat =" server"

Height =" 50px" Width =" 125px">

< asp:Button ID =" Button2" RUNAT = QUOT;服务器" OnClick =" Button1_Click"

Text =" Button" />

< asp:TextBox ID =" TextBox2"

runat =" server">< / asp:TextBox>< / asp:面板>


< / div>

< asp:Panel ID =" Panel2" DefaultButton = QUOT;将Button3" runat =" server"

Height =" 50px" Width =" 125px">

< asp:Button ID =" Button3" RUNAT = QUOT;服务器" OnClick =" Button1_Click"

Text =" Button" />

< asp:TextBox ID =" TextBox1"

runat =" server">< / asp:TextBox>< / asp:面板>

< / form>


protected void Button1_Click(对象发送者,EventArgs e)

{

Response.Write((发件人为Button).ID);

}


问候,

Walter Wang (wa****@online.microsoft.com,删除''在线。'')

Microsoft在线社区支持


===== =============================================

在回复帖子时,请回复群组通过你的新闻阅读器

其他人可以从你的问题中学习并从中受益。

==================== ==============================

此帖子提供按现状 ;没有保证,也没有授予任何权利。

Hi Alex,

Both the HtmlForm and the Panel have a property named DefaultButton could
let you assign a default button when ENTER key is pressed:

<form id="form1" defaultbutton="Button1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Panel ID="Panel1" DefaultButton="Button2" runat="server"
Height="50px" Width="125px">
<asp:Button ID="Button2" runat="server" OnClick="Button1_Click"
Text="Button" />
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox></asp:Panel>

</div>
<asp:Panel ID="Panel2" DefaultButton="Button3" runat="server"
Height="50px" Width="125px">
<asp:Button ID="Button3" runat="server" OnClick="Button1_Click"
Text="Button" />
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox></asp:Panel>
</form>

protected void Button1_Click(object sender, EventArgs e)
{
Response.Write((sender as Button).ID);
}

Regards,
Walter Wang (wa****@online.microsoft.com, remove ''online.'')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


这篇关于帮助:[RETURN]键不提交表单(ASP.NET 2.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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