On 2/19/02 2:38 PM, "Tim Roberts" <timr@...> wrote:
> On 19 Feb 2002 14:53:38 -0600, Ian Bicking wrote:
>> No, rather when no submit button field was found, a default submit
>> button should be assumed. IE and Mozilla will submit a form when an
>> enter is hit under certain circumstances. I believe this will lead to
>> the form being submitted without any named submit button being sent
>> (yes?) -- in this case, FFK should act as though the default submit
>> button was hit.
> You are correct -- my mistake. I thought the browsers mapped the enter key to
> the first submit button, but an experiment just proved I was wrong: the form
> data is posted with no submit data at all.
I haven't used WebWare enough to know how forms and actions are handled in
WebKit, but I can tell the story of how Zope dealt with this situation.
At some point in the development of Principia/Bobo (Zope before it was
Zope), Jim Fulton added a new bobo marshalling type called 'method', which
did a few tricks to basically allow a form to have multiple destinations
which the publisher would map out and add to the traversal path. For
example, with the following form:
<input type="submit" name="do_rename:method" value="Rename">
<input type="submit" name="index_html:method" value="Cancel">
Would (through tricks of the publisher) end up calling the method
"url_something.do_rename" or "url_something.index_html", depending on which
submit button was clicked.
But, especially with forms like 'rename', we were running into the same
issue - it was user habit to enter the new name, and just hit 'return'.
Typically, this was fine in Bobo since the form's action was usually a
method, but for these multiple dispatch forms, it was usually just an object
(or something that would evaluate to an object). So just hitting return
would take the user to an unexpected place. This was not good.
It was solved with another trick. It's not pretty, but it gets the job done
in about the best way the job could be done. Jim added another Bobo
marshalling type called "default_method", which was usually used in a hidden
field like this:
<input type="hidden" name=":default_method" value="do_rename">
So then, when the publisher was processing the HTTP request to traverse to
the correct object, if a ':default_method' was found and no other ':method'
values found, the value of the :default_method field was used to figure out
where to dispatch the call to.
So, my suggestion would be to find a way of doing something similar - let
the developer of a form decide the default action and specify it somehow.
Jeffrey P Shell