You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mallet <ry...@gmail.com> on 2008/10/29 21:04:46 UTC

IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by mallet <ry...@gmail.com>.
FYI, I did try some of the suggestions in here but to no avail:
http://www.nabble.com/Form-Enter-Key-Problem-td14408121.html

Also I have investigated using some custom JavaScript manipulate IE, but I
would like to avoid a messy solution like that if possible.
-- 
View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20234941.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Yeah wicket does override id's.. But be carefull when manually assigning 
them. You could also do it the otherway around and spew out the correct 
id from the wicket side, into your js.

Im not sure how well Wicket likes manual id's and ajax.

mallet wrote:
> Solution: Igor's solution worked.  I just had to make one small fix in my
> java code for my modal.  The problem was that the DOM contained no element
> with id = "okButton".  A co-worker of mine pointed out that the id I assign
> to my submit input in the HTML template is being overwritten by Wicket when
> I created my AjaxButton.  As a result, I had to add this:
> okButton.setMarkupId("okButton");
>
> Then using document.getelementbyid('okButton').onclick() worked.
>
> Everything is working great now and I appreciate the responses.
>
> Here is the final code for my PasswordTextField:
>
>       PasswordTextField passwordTextField = new
> PasswordTextField("password", new Model<String>());
>       passwordTextField.add(new
> AjaxFormComponentUpdatingBehavior("redirectEnterButton") {
>         @Override
>         public void onComponentTag(ComponentTag tag) {
>           super.onComponentTag(tag);
>           tag.put("onkeypress", "if (wicketKeyCode(event) == 13) {
> document.getElementById('okButton').onclick();return false;};");
>           tag.put("onkeydown", "if (wicketKeyCode(event) == 13) { return
> false; ");
>           tag.put("onkeyup", "if (wicketKeyCode(event) == 13) { return
> false;};");
>           tag.put("onchange", "if (wicketKeyCode(event) == 13) { return
> false;};");
>           tag.put("onchangeoriginal", "if (wicketKeyCode(event) == 13) {
> return false;};");
>         }
>         
>         @Override
>         protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
>           //Required to override this function
>         }
>       });
>
>
>
> mallet wrote:
>   
>> I tried as you suggested, but it gives me the 404 error in IE again.  The
>> browser bar in the 404 window has these parameters in it, after I typed
>> asdfasdf and hit enter:
>> ?pnList%3A0%3Aorders%3A0%3ApasswordModal%3Acontent%3Aform%3Apassword=asdfasdf
>>
>> I can put an alert('hi') in place of
>> document.getelementbyid('okButton').onclick(), and it alerts me.  Or I can
>> simply do return false; and the enter button will be deactivated.  But for
>> some reason I am not able to access the okButton's onclick function like
>> this... or maybe I am accessing it, but the problem is in there.
>>
>> I'll try some other things and get back if I find a solution.
>>
>>
>> igor.vaynberg wrote:
>>     
>>> if (wicketKeyCode(event) == 13) {
>>>   document.getelementbyid('myajaxbuttonsid').onclick(); }
>>>
>>> -igor
>>>
>>> On Wed, Oct 29, 2008 at 2:34 PM, mallet <ry...@gmail.com> 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 <ry...@gmail.com> 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: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> --
>>>> 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: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>       
>>     
>
>   

-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by mallet <ry...@gmail.com>.
Solution: Igor's solution worked.  I just had to make one small fix in my
java code for my modal.  The problem was that the DOM contained no element
with id = "okButton".  A co-worker of mine pointed out that the id I assign
to my submit input in the HTML template is being overwritten by Wicket when
I created my AjaxButton.  As a result, I had to add this:
okButton.setMarkupId("okButton");

Then using document.getelementbyid('okButton').onclick() worked.

Everything is working great now and I appreciate the responses.

Here is the final code for my PasswordTextField:

      PasswordTextField passwordTextField = new
PasswordTextField("password", new Model<String>());
      passwordTextField.add(new
AjaxFormComponentUpdatingBehavior("redirectEnterButton") {
        @Override
        public void onComponentTag(ComponentTag tag) {
          super.onComponentTag(tag);
          tag.put("onkeypress", "if (wicketKeyCode(event) == 13) {
document.getElementById('okButton').onclick();return false;};");
          tag.put("onkeydown", "if (wicketKeyCode(event) == 13) { return
false; ");
          tag.put("onkeyup", "if (wicketKeyCode(event) == 13) { return
false;};");
          tag.put("onchange", "if (wicketKeyCode(event) == 13) { return
false;};");
          tag.put("onchangeoriginal", "if (wicketKeyCode(event) == 13) {
return false;};");
        }
        
        @Override
        protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
          //Required to override this function
        }
      });



mallet wrote:
> 
> I tried as you suggested, but it gives me the 404 error in IE again.  The
> browser bar in the 404 window has these parameters in it, after I typed
> asdfasdf and hit enter:
> ?pnList%3A0%3Aorders%3A0%3ApasswordModal%3Acontent%3Aform%3Apassword=asdfasdf
> 
> I can put an alert('hi') in place of
> document.getelementbyid('okButton').onclick(), and it alerts me.  Or I can
> simply do return false; and the enter button will be deactivated.  But for
> some reason I am not able to access the okButton's onclick function like
> this... or maybe I am accessing it, but the problem is in there.
> 
> I'll try some other things and get back if I find a solution.
> 
> 
> igor.vaynberg wrote:
>> 
>> if (wicketKeyCode(event) == 13) {
>>   document.getelementbyid('myajaxbuttonsid').onclick(); }
>> 
>> -igor
>> 
>> On Wed, Oct 29, 2008 at 2:34 PM, mallet <ry...@gmail.com> 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 <ry...@gmail.com> 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: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20252256.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by mallet <ry...@gmail.com>.
I tried as you suggested, but it gives me the 404 error in IE again.  The
browser bar in the 404 window has these parameters in it, after I typed
asdfasdf and hit enter:
?pnList%3A0%3Aorders%3A0%3ApasswordModal%3Acontent%3Aform%3Apassword=asdfasdf

I can put an alert('hi') in place of
document.getelementbyid('okButton').onclick(), and it alerts me.  Or I can
simply do return false; and the enter button will be deactivated.  But for
some reason I am not able to access the okButton's onclick function like
this... or maybe I am accessing it, but the problem is in there.

I'll try some other things and get back if I find a solution.


igor.vaynberg wrote:
> 
> if (wicketKeyCode(event) == 13) {
>   document.getelementbyid('myajaxbuttonsid').onclick(); }
> 
> -igor
> 
> On Wed, Oct 29, 2008 at 2:34 PM, mallet <ry...@gmail.com> 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 <ry...@gmail.com> 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: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-tp20234862p20237669.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by Igor Vaynberg <ig...@gmail.com>.
if (wicketKeyCode(event) == 13) {
  document.getelementbyid('myajaxbuttonsid').onclick(); }

-igor

On Wed, Oct 29, 2008 at 2:34 PM, mallet <ry...@gmail.com> 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 <ry...@gmail.com> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by mallet <ry...@gmail.com>.
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 <ry...@gmail.com> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE7 ignores AjaxButton onSubmit when I use the keyboard enter key

Posted by Igor Vaynberg <ig...@gmail.com>.
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 <ry...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org