Re: Form and enter key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dale Attree wrote:
In your opening form tag

<form onsubmit="CheckKey()">

In CheckKey, check if enter was hit, if so call your AJAX function.

If the submit button was clicked, your keycode will be blank and then you
can submit the form.

Thank you Dale.
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.


Dale

-----Original Message-----
From: Alf Stockton [mailto:alf@xxxxxxxxxxxxxx] Sent: 08 May 2007 12:57 PM
To: php windows
Subject: Re:  Form and enter key

Alf Stockton wrote:
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.

Suggestions please.

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.




--
Regards,
Alf Stockton		www.stockton.co.za

Q:	What's a light-year?
A:	One-third less calories than a regular year.
My email disclaimer is available at www.stockton.co.za/disclaimer.html

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux