Firefox PHP

Finishing a post by hitting ENTER

Posted by MiKolar 
Finishing a post by hitting ENTER
May 01, 2006 01:28AM
I found that (in Phorum 5.1.10) it's not possible to send off otherwise properly
finished message just by hitting ENTER in the Subject (or Your name/e-mail for
unregistered users) fields, instead of clicking on the "Post message" button.
If you do that, nothing happens and warning/no error message is issued,
which may be confusing.

I found a simple fix for that behavior: Add into posting.php after line # 162
the following line:
if(!($finish || $cancel || $preview || $initial || empty($_POST))) $finish=1;

-----
After this addition, that part of posting.php will look like this:
.
.
.
// ----------------------------------------------------------------------
// Gather information about the editor state and start processing
// ----------------------------------------------------------------------

// Is this an initial request?
$initial = ! isset($_POST["message_id"]);

// Is finish, cancel of preview clicked?
$finish = (! $initial && isset($_POST["finish"]));
$cancel = (! $initial && isset($_POST["cancel"]));
$preview = (! $initial && isset($_POST["preview"]));

// If one just hits ENTER (instead of clicking on the "Post message" button): M.K.
if(!($finish || $cancel || $preview || $initial || empty($_POST))) $finish=1;

// Do we already have postingargs or do we use the global args?
if (! isset($PHORUM["postingargs"])) {
$PHORUM["postingargs"] = $PHORUM["args"];
}
.
.
.
----------

mk
Re: Finishing a post by hitting ENTER
May 01, 2006 06:08AM
The default behaviour on ENTER should be that the form is not processed, but that the cursor does get the focus to the next logical field to fill in. The default template has a body onload event for that.

I'm not sure if posting the form using ENTER would be the most ergonomical thing to do. I did try it once on my forum, but then found out that my users hit ENTER a lot and ended up posting partial messages. But if this works for you, then it's great ;)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Finishing a post by hitting ENTER
May 02, 2006 12:43PM
I think you cannot post partial messages because the same checks must be done on ENTER as on clicking on the POST button.

Hitting ENTER is natural when you make a mistake the first time (e.g. leaving empty a field or making an error in the e-mail address), you are returned to the form, correct that field, and then it is quite natural to hit ENTER - it is more ergonomical in this situation than to scroll down and look for the POST button. If the form is filled correctly at this moment, and nothing happens on ENTER, then you are confused (at least I was, because I am used to that ENTER works in other forms at this moment).

mk
Re: Finishing a post by hitting ENTER
May 02, 2006 02:56PM
I have found relying on the enter button to be inconsistent across the internet. I have stopped using it to submit forms for this reason. Plus, hitting enter in the text area does not submit the form. So, you have to tab or mouse if you are typing the message. And, I know for replies that is all I type, the message.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Sorry, only registered users may post in this forum.

Click here to login