locoboy
locoboy

Reputation: 38910

What does the "." action property in form tag do?

I have a form tag that has action=".". What exactly does this mean?

Upvotes: 0

Views: 4659

Answers (2)

Quentin
Quentin

Reputation: 943207

The same as any other action attribute — it specifies the URI to submit to.

. is a relative URI equivalent to ./, i.e. the same as the current URI with the fragment identifier, query string and everything after the last / stripped off.

For example, from http://example.com/foo/bar.html?baz=1#fragment it resolves to http://example.com/foo/.

Upvotes: 2

Marcx
Marcx

Reputation: 6826

I never saw it in a action but it means "same directory" just like ".." means previous directory.

If the filename is omitted on the action (action="") the form simply redirect on the same file, using the . otherwise the form redirect on the same directory without file name...

File http://localhost/index.html

<form action="">  // redirect on http://localhost/index.html?
<form action="."> // redirect on http://localhost/?

Upvotes: 1

Related Questions