weixin_33701294 2009-10-14 17:00 采纳率: 0%
浏览 16

提交表单问题…输入密钥

I have a form containing several drop lists and a text field, and a button...

When I click the button, an ajaxfunction is called... the ajax then calls a php function which gets results from a mysql db...

The problem is that I cant do the same thing by just hitting enter in the form, the page just gets refreshed...

That explained, I think the form gets submitted, but ignores the ajaxfunction when hitting enter, EVEN though i have " onSubmit="AjaxFunction();" in the form tag...

Any ideas?

Does anybody know a way to ignore the form submit when hitting enter? and maybe instead click the button when hitting enter?

Thanks...

  • 写回答

2条回答 默认 最新

  • 程序go 2009-10-14 17:02
    关注

    change your onsubmit to onsubmit="return AjaxFunction();" and return false from your AjaxFunction. That will prevent the form from submiting.

    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题