stockton Posted May 8, 2007 Share Posted May 8, 2007 I have created an HTML form that contains an input type text field coded as:- <input type=text name="CardNumber" id="CardNumber" onBlur="sendRequest('.$ClientData.",".$Event.',this.value)"> This calls an Ajax script that populates the rest of the HTML form. This fields event is currently activated, in Firefox, via the TAB but the user has requested that the activation be altered to Enter. The problem I have is that Enter is the default action for the form and I cannot think of a way to achieve what the user requires. This means that not only do I want to "Prevent Enter From Submitting Form" but also cause enter to call Ajax. In Ajax I can then if (windows.event.keyCode != 13) return; or similar. What I have done so far is alter the HTML FORM line to:- <form name = 'TicketIssue' id='TicketIssue' method='get' onSubmit='return false;'> which appears to have stopped the form submitting on Enter and I have added:- if (window.event.keyCode != 13) { window.event.keyCode = 0; return; } to my sendRequest() in my Ajax. This, however, appears to do nothing for me. In Firebug on my :- if (window.event.keyCode != 13)) I get :- window.event has no properties http://10.0.0.3/Events/js/ajax.js Line 39 Suggestions please. Quote Link to comment Share on other sites More sharing options...
fenway Posted May 9, 2007 Share Posted May 9, 2007 FF and IE have different event models. Quote Link to comment Share on other sites More sharing options...
stockton Posted May 10, 2007 Author Share Posted May 10, 2007 I know that I have seen code that handles these different event models, but cannot for the life of me remember where. Quote Link to comment Share on other sites More sharing options...
fenway Posted May 10, 2007 Share Posted May 10, 2007 FF doesn't have window.event, it "automatically" gets the event via the handler. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.