没有动作的 HTML 表单 [英] HTML Forms without actions

查看:23
本文介绍了没有动作的 HTML 表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Django/Pinax 中,我遇到过这样开头的登录表单:

In Django / Pinax, I've come across the login form which starts like this :

<form class="login" method="POST" action="">

它运行良好.因此,我假设某些 java 脚本或 Django 框架中的某些内容将值放入 action 属性中.
所以,我的问题:

It works perfectly well. So I assume that either some java-script or something in the Django framework is putting the value into the action attribute.
So, my questions:

  • Django 如何插入动作?
  • 他们为什么要这样做?
  • 我怎样才能知道这个表单的作用是什么?

更新:我发现这根本不是 Django 的事情,而是大多数浏览器所做的事情.

Update : I see this is not a Django thing at all, but what most browsers do.

推荐答案

在大多数浏览器中使用空字符串操作会将表单指向浏览器当前加载的 URL,这是第一个为表单提供服务的脚本地点.

Having an action of an empty string in most browsers points the form at the URL the browser currently has loaded, which is the script that served the form in the first place.

这篇关于没有动作的 HTML 表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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