What Does an Entry "Action=''" in HTML Form Mean

What does an entry action='.' in html form mean?

. is the current path segment of the current URL. In other words, it refers to the current relative URL.

If your current URL is http://example.com/foo/bar/baz/, then . refers to http://example.com/foo/bar/baz/ (yes, same URL).

It's a bit trickier without a trailing slash. On http://example.com/foo/bar/baz, . refers to http://example.com/foo/bar/. That's why it's not usually a good idea to use .; you could use action="" instead, which means action has an empty value, in which case the current (full) URL is substituted.

This . is pretty universal and is used in many contexts involving URLs or file paths.

What does an entry action='?' in html form mean?

It uses the current URL with an empty query string as the action of the form. An empty query string. Empty. Meaning no query string at all. The query string will be no more. It will not be used. It will be gone. There will be no more query string after submitting the form. The query string will have vanished. Disappeared. Gone away. Become no more.

what do form action=# and form method=post action=# do?

Action normally specifies the file/page that the form is submitted to (using the method described in the method paramater (post, get etc.))

An action of # indicates that the form stays on the same page, simply suffixing the url with a #. Similar use occurs in anchors. <a href=#">Link</a> for example, will stay on the same page.

Thus, the form is submitted to the same page, which then processes the data etc.

what do form action=“.”

Form Action attribute specifies where to send the form-data when a
form is submitted

Possible accepted values:

  1. An absolute URL: points to another web site (like action="http://www.example.com/example.htm")
  2. A relative URL - points to a file within a web site (like action="example.htm")

in your case of action="." you are pointing to current url/file/directory.
So it will reload the same page on form submission.

HTML: Define the action of enter in a form

The default behavior of a <button> element is to act like a 'submit' button. Try using <button type='button'> for the non-submit buttons.

What does it mean when the form action attribute is # (number/pound symbol/sign/character)?

The meaning of # as a URL reference (whether as action or formaction attribute value or otherwise) is a reference to the start of the current base document. The base document is the current document, unless a <base href=...> tag has been set.

What happens depends on the situation. Typically, the browser requests for the page again with a query part in the URL (and the page is loaded again, which may imply that client-side scripts are run), but if the same query had been used earlier, the browser probably uses its cache. Moreover, as the start of the document is referred to, focus on any form element is lost and the page may scroll backwards.

So although # is fairly common in some coding styles, it is not reliable; its purpose is better achieved using client-side event handlers.

The formaction attribute has a meaning only for submit buttons. A text input element does not constitute a submit button, even though it may trigger form submission, so here the attribute is ignored.

Set a form's action attribute when submitting?

Attach to the submit button click event and change the action attribute in the event handler.

create a html form with 2 action pags

First of all, what do you mean by correct input?
Main form data validation occurs in server side, not client side. you'd better use client side just for simple verification, like for typos.

There is no need for 2 destination pages (as you call it so).
You may use the standard action attribute which is the page on the server to which you are sending your form data.

there, You have the option to decide which condition needs what action and send the data (and then the user) to the desired page / action.

Django : HTML form action directing to view (or url?) with 2 arguments

You are trying to use the reverse resolution of urls in Django.

In your html file correct form action url to the following and method should be POST:

<form action={% url 'process' %}  method="POST">

In case you are trying to pass parameters along then use this:

<form action={% url 'process' request.user.id 4 %}  method="POST">

Reference:
https://docs.djangoproject.com/en/1.10/topics/http/urls/



Related Topics



Leave a reply



Submit