Simple question about submit

It’s such a simple question … and I can’t find an answer.

When I put up a form and I have a submit button … cleary when the user
clicks on it a uri is generated. What is that uri?

In other words … what method in which controller is generally called
when the user hits to submit button?

Ralph S. wrote:

It’s such a simple question … and I can’t find an answer.

Because it’s a basic HTML question, not a Rails one.

When I put up a form and I have a submit button … cleary when the user
clicks on it a uri is generated. What is that uri?

Whatever the tag’s action is.

In other words … what method in which controller is generally called
when the user hits to submit button?

Whatever method your routes map that URL to.

–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

Marnen Laibow-Koser wrote:

Whatever the tag’s action is.

Also, if no action is specified via the form tag, the form is submitted
to the current url.

So if ‘thing/edit/1’ contained:

The form would be submitted back to ‘thing/edit/1’

Ralph S. wrote:

Rob and Marnen:

Thank you!

I am now curious why the designers of HTML put the “place to go” on the
form tag rather than on the tag.

My guess: the idea is that the action is a property of the form, not
the submit button. But take this up on an HTML forum if you want better
answers. We’re out of Rails territory here.

Ralph

Rob and Marnen:

Thank you!

I am now curious why the designers of HTML put the “place to go” on the
form tag rather than on the tag.

Ralph

Rob N. wrote:

Marnen Laibow-Koser wrote:

Whatever the tag’s action is.

Also, if no action is specified via the form tag, the form is submitted
to the current url.

So if ‘thing/edit/1’ contained:

The form would be submitted back to ‘thing/edit/1’

No. without an action is invalid HTML, so its behavior is
undefined. An action must always be specified.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

Marnen Laibow-Koser wrote:

Rob N. wrote:

Marnen Laibow-Koser wrote:

Whatever the tag’s action is.

Also, if no action is specified via the form tag, the form is submitted
to the current url.

So if ‘thing/edit/1’ contained:

The form would be submitted back to ‘thing/edit/1’

No. without an action is invalid HTML, so its behavior is
undefined. An action must always be specified.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

Thank you for that comment on what should happen. However, the fact
remains that if you don’t specify a target action, browsers will send
the submitted data to the current url. Don’t confuse ‘must’ with
‘should’.

On 8 July 2010 09:04, Rob N. [email protected] wrote:

remains that if you don’t specify a target action, browsers will send
the submitted data to the current url. Don’t confuse ‘must’ with
‘should’.

How do you know that the next version of FF will do that? Have you
tested all available browsers? What about Chinese versions? If you
develop a website that does not generate valid html then next week an
update to IE may break the website and your clients/users will not be
happy.

Colin

On 8 July 2010 09:04, Rob N. [email protected] wrote:

Marnen Laibow-Koser wrote:

No. without an action is invalid HTML, so its behavior is
undefined. An action must always be specified.

Thank you for that comment on what should happen. However, the fact
remains that if you don’t specify a target action, browsers will send
the submitted data to the current url. Don’t confuse ‘must’ with
‘should’.

Yet you make the mistake yourself by saying “browsers will” instead of
“browsers may”.

What action the user agent performs if an ‘action’ parameter of a form
is anything other than an http(s):// url is undefined… so they’re
free to do what they want.
http://www.w3.org/TR/html401/interact/forms.html#h-17.3

If you want to be sure a form submits how you want, you must
include an action parameter. If you don’t care what your form does,
then you should do whatever you prefer :slight_smile:

On this and other forums I sometimes get the suggestion “Try it”.

I have made the comment in forums to the effect that “Just because it
works does not mean that it is defined to work”.

On 8 July 2010 09:09, Colin L. [email protected] wrote:

If you
develop a website that does not generate valid html then next week an
update to IE may break the website and your clients/users will not be
happy.

ahem one may develop websites with valid html and this week, and
find the current IE will break it! :wink:

Joking aside - if you don’t produce valid html and css (or fail to
follow any other standards) one’s sites are much less likely to work
on a variety of browsers.
On the flip side, if you do endeavour to produce as valid markup as
possible, you may be pleased to see your site render more closely to
your intention in browsers you never even dreamed of testing on.

Ralph S. wrote:

On this and other forums I sometimes get the suggestion “Try it”.

I have made the comment in forums to the effect that “Just because it
works does not mean that it is defined to work”.

That sounds like something I hear at work from time to time…

“It is not known not to work”…