
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tlug] Re: Any HTML experts?
- Date: Wed, 10 Jan 2007 18:36:00 +1100 (EST)
- From: Jim Breen <Jim.Breen@example.com>
- Subject: [tlug] Re: Any HTML experts?
Jesse Costa <dazeysan@example.com> wrote:
>> On 1/6/07, Jim Breen <Jim.Breen@example.com> wrote:
>> > 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 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.
Walter Hansen <gandalf@example.com> added:
>> <d0e978600701062126l1d593a44h80552ddc57ecd258@example.com>
>>
>> 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.
Thanks for that suggestion, Jesse. It seems to work fine, but as
Walter thought, disabling JS locks it up.
I may be able to give users a choice of forms.
Many thanks
Jim
--
Jim Breen http://www.csse.monash.edu.au/~jwb/
Clayton School of Information Technology, Tel: +61 3 9905 9554
Monash University, VIC 3800, Australia Fax: +61 3 9905 5146
(Monash Provider No. 00008C) ジム・ブリーン@モナシュ大蛙触Â
Home |
Main Index |
Thread Index