I was sure the "return false" part would make sure the form wouldn't
be submitted, but I think the onsubmit action (which triggers an AJAX
call to submit the form) interferes somehow.

Does anyone have a clue?

Thanks!

Jaap


On 21 aug, 10:56, jhaagmans <jaap.haagm...@gmail.com> wrote:
> Hi,
>
> I'm using a RedBox to display an AJAX registration/login form. The
> problem with RedBox is that you can't use two forms inside a RedBox.
> I'm not sure why that is, but it just doesn't work. My solution was to
> put both the login part and the registration part in one form and
> toggle both form-parts using a radio button. So far no problems: it
> works nicely. However, I really want both form parts to go to
> different actions, so I set the form action to the registration url
> and added a button in the (at first hidden) login part that submits
> the form to the login url. That also works nicely. When enter is
> pressed, however, it will submit to the registration URL. I thought
> I'd work around that using a keypress handler on the login textfields,
> which works, but after initiating the request to the login action, it
> will also send a request to the general form action.
>
> The code I use for the onKeypress handler is this:
>
> function check_login_keypress(myfield, e) {
>     var keycode;
>     if (window.event) keycode = window.event.keyCode;
>     else if (e) keycode = e.which;
>     else return true;
>
>     if (keycode == 13)
>     {
>         new Ajax.Request('/user_sessions', {asynchronous:true,
> evalScripts:true, parameters:Form.serialize(myfield.form)});
>         return false;
>     }
>     else
>         return true;
>
> }
>
> What am I doing wrong?
>
> Thank you in advance!
>
> Kind regards,
> Jaap Haagmans

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to