Closed GoogleCodeExporter closed 9 years ago
I found a 'workaround' in the mean time (Just need to adjust the #formAddNewRow
and #btnAddNewRowOk to be whatever might have been passed in for
sAddNewRowFormId and sAddNewRowOkButtonId)
$('#formAddNewRow').live('keyup', function(e){
if (e.keyCode == 13) {
$('#btnAddNewRowOk').click()
}
});
The question still stands, without doing what I did above.. hitting enter will
just reload the entire page.
Why?
What is happening?
Does anyone else see this behaviour?
Original comment by kenneth....@gmail.com
on 2 Jun 2011 at 3:18
Looks like it is because the form doesn't have any buttons on it and the
default action is ="#".
So when enter is hit, it submits the form to # (page reload).
Trying to capture the enter key was hit and miss..
A more reliable way is this instead.
Unbind .submit for that form, and rebind a new submit that triggers the click()
on the button.
$("#formAddNewRow").unbind('submit');
$("#formAddNewRow").submit(function(){
//simulate click on create button
$("#btnAddNewRowOk").click();
return false;
});
Original comment by kenneth....@gmail.com
on 2 Jun 2011 at 3:57
I have reproduced this probelm - I will take a look at this.
Regards,
Jovan
Original comment by joc...@gmail.com
on 2 Jun 2011 at 4:41
FYI. The reason that it isn't happening on the jquery-ui demos is that they
have a form already in their page defined as <form>. So obviously there is no
action= attribute, which means that enter just does nothing.
For whatever reason, when you dynamically create the form, the action attribute
is added to the form and set to ="#".
Original comment by kenneth....@gmail.com
on 2 Jun 2011 at 6:02
In the latest version I have placed your code but it does not submit form on
enter it just ignores ENTER key.
For now this is a temporary fix - at least it does not closes the form. I will
see why this is happening and how can I submit it on ENTER.
Original comment by joc...@gmail.com
on 2 Jun 2011 at 6:21
Sounds good to me.
Thanks for jumping on the issue.
Oh, and it wasn't you dynamically adding the action="#"..
I forgot that we are responsible for adding the form to the page.. and we had
placed that attribute on there.. Still same result.. just wanted to call out
that I wasn't pointing the figure at you for putting the attribute on there..
-k
-k
Original comment by kenneth....@gmail.com
on 2 Jun 2011 at 6:28
I'm cosing this issue.
Ignoring ENTER key/submission will be standard feature in this version of
plugin.
Original comment by joc...@gmail.com
on 3 Jun 2011 at 5:56
Original issue reported on code.google.com by
kenneth....@gmail.com
on 2 Jun 2011 at 2:49