Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Any HTML experts?
- Date: Sat, 06 Jan 2007 23:23:55 -0800
- From: Walter Hansen <gandalf@example.com>
- Subject: Re: [tlug] Any HTML experts?
- References: <200701070229.l072TBDE015163@example.com> <d0e978600701062126l1d593a44h80552ddc57ecd258@example.com>
- User-agent: Thunderbird 1.5.0.9 (Windows/20061207)
I thought there might be a JS way to do this. Be sure to test it with javascript disabled. We used forms that used JS validation and I found that with JS turned off the forms were completely non functional.
Jesse Costa wrote:On 1/6/07, Jim Breen <Jim.Breen@example.com> wrote:
I've RTFMed (RedTFM?) but I haven't found an answer to this.
In HTML forms, is there any way to stop the pressing of the Enter key after putting in text in a <input type="text" .... > box from sending in the whole form? Basically I'd like the *only* way for the form to be sent is the pressing of the <INPUT type="submit" .... > button.
I'm reluctant to change over to <textarea ....> boxes, because I really only want single-line input.
There's probably a Javascript solution, but I'd prefer a vanilla HTML one.
TIA
Jim
I don't think it can be done with vanilla HTML, but this has very little JavaScript and it's all in the tags, no extra <script> at the top:
<form name="myform" action="testform.html" method="get" onSubmit="return false;"> <input type="text" name="text1" /> <input type="button" onClick="document.myform.submit();" value="Submit" /> </form>
In the form tag, onSubmit="return false;" will prevent the Enter key and submit buttons from working. A plain button, rather than a Submit button, with the onClick event shown above will then submit the form. This will only respond to a direct click on the button or the Enter key when the button has focus.
HTH
Jesse
- Follow-Ups:
- Re: [tlug] Any HTML experts?
- From: Jesse Costa
- References:
- [tlug] Any HTML experts?
- From: Jim Breen
- Re: [tlug] Any HTML experts?
- From: Jesse Costa
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] linux in Japanese schools
- Next by Date: Re: [tlug] Any HTML experts?
- Previous by thread: Re: [tlug] Any HTML experts?
- Next by thread: Re: [tlug] Any HTML experts?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links