if (wicketKeyCode(event) == 13) { document.getelementbyid('myajaxbuttonsid').onclick(); }
-igor On Wed, Oct 29, 2008 at 2:34 PM, mallet <[EMAIL PROTECTED]> wrote: > > Igor, > > Thanks for your reply. Here's what I did: > > PasswordTextField passwordTextField = new > PasswordTextField("password", new Model<String>()); > > passwordTextField.add(new > AjaxFormComponentUpdatingBehavior("onkeydown") { > @Override > public void onComponentTag(ComponentTag tag) > { > super.onComponentTag(tag); > tag.put("onkeydown", "if (wicketKeyCode(event) == 13) { > return false;}; "); > > } > > }); > > However, the problem I have now is that the enter key no longer submits the > form through my AjaxButton's onSubmit function. It simply disables the > enter key from doing anything. This is better than before, but the users of > this want to use the enter key to submit the form rather than the mouse > click. > > I wonder if there is any way I can have it propagate the enter key to call > the same function as when I press the AjaxButton with my mouse? > > > igor.vaynberg wrote: >> >> easiest thing is to simply disable the enter key on the textfield by >> override onkeydown >> >> -igor >> >> On Wed, Oct 29, 2008 at 1:04 PM, mallet <[EMAIL PROTECTED]> wrote: >>> >>> I have a ModalWindow containing a class extending Panel. On the Panel I >>> have >>> a class extending Form. >>> The Form contains a custom AjaxButton which overrides protected void >>> onSubmit(AjaxRequestTarget target, Form<?> form). >>> >>> When I click this button it retrieves text from a PasswordField and >>> validates it. It displays an error message on my Panel's FeedbackPanel >>> in >>> the event of en error; otherwise it closes the ModalWindow and refreshes >>> the >>> calling page. >>> >>> This works flawlessly when I use the mouse button to click my AjaxButton. >>> It also works in FireFox3 when I use the enter button. But in IE7 when I >>> use the enter button instead of the mouse, it gives me a 404 error in my >>> browser and the modal window disappears without running the onSubmit >>> function. >>> >>> Any suggestions on how to make this work for IE7? >>> >>> I would like to use a ModalWindow if at all possible instead of popping >>> up >>> another page. >>> >>> Here is my HTML: >>> >>> <html xmlns:wicket="http://wicket.sourceforge.net/" lang="EN-US"> >>> <wicket:panel> >>> <form wicket:id="form" action=""> >>> <table width="75%" cellpadding="5" cellspacing="0" border="0" >>> align="center"> >>> <tr> >>> <td colspan="2"> >>> <div class="formFeedback" wicket:id="feedback"></div> >>> Password: <input type="password" wicket:id="password" >>> name="Password"></input> >>> </td> >>> </tr> >>> <tr> >>> <td align="center"> >>> <input type="submit" wicket:id="okButton" value="Delete"/> >>> </td> >>> <td> >>> # Cancel >>> </td> >>> </tr> >>> </table> >>> </form> >>> </wicket:panel> >>> </html> >>> >>> ------------- >>> >>> Here is my AjaxButton which I add to my Form object. >>> >>> add(new AjaxButton("okButton", this) { >>> @Override >>> protected void onSubmit(AjaxRequestTarget target, Form<?> form) { >>> if(form.get("password") != null && >>> (PasswordTextField)form.get("password") != null) { >>> String userEnteredPassword = >>> ((PasswordTextField)form.get("password")).getInput(); >>> if(userEnteredPassword != null && >>> !userEnteredPassword.equals("") && validPassword(userEnteredPassword)) { >>> //Delete successful; closing window >>> window.close(target); >>> return; >>> } >>> } >>> error("Invalid password"); >>> } >>> --------------------- >>> >>> Thanks. >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20234862.html >>> Sent from the Wicket - User mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- > View this message in context: > http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20236367.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]