chrometweaks.org

Are there localised versions of small business products on iPage web hosting and e-commerce for Sing

Click Here To View All Answers...


Got a question, hope someone can answer... Are there localised versions of small business products on iPage web hosting and e-commerce for Sing Thanks for any answer or 2. Another question I got... Hi there, want to ask how to make it so that after typing into a form, the user can just press enter to click a particular button, i.e. the submit button. So for example, if they start using the form by, say, selecting an option from a select input, they can then press enter to hit the 'go' button...

Comments (8)

Yes sir! however you might wanna make sure and wait for another commenter to confirm this as I am not completely sure. Better yet, why don't you contact the iPage guys because they can answer you better...

Comment #1

Ahh that is true, but he never said anything about a image as the button, just a button..

Good catch goldi..

Comment #2

Ok, your both right. It doesn't happen automatically, but I'm not using an image as a button. I am however not submiting directly, but calling formHandler() first. Sorry, I guess I should have said all this before. I tried to implement that script you suggested goldilocks, but couldn't get it to work. Here's the relevant page code:.

Any further help welcome :0)..

Comment #3

Ahh you are using a button, not a submit button. tha tbutton is control by javascript and you can't do what you wanted..

You could have an onchange in the select tag and make it do what you want without the need of that button. so whenever you change the select statement it will open that page..

<select class="select" name="select" onChange="formHandler1();">..

Comment #4

Hi scoutt, thanks for that. Even so, I'm not sure. See, I think it would be a little confusing to have the select without the go, however, with the onChange event handler, there's no point it being there. No way of having the best of both ways?.

Iain..

Comment #5

I cannot see where the user does any typing..

Are there some INPUT boxes not shown?.

Why would the user press <Enter> after selecting from a drop down?.

You could set the focus to the button when the value of the SELECT changes:.

<select class="select" name="select" onchange="this.form.button.focus()">.

But that's not natural behavior..

Also, you're gonna run into trouble with naming stuff like:.

<select class="select" name="select">..

Comment #6

I've got something, at least for Internet Explorer..

Add this script to the head tag:.

And then, add this attribute to every field in the form that you want to trigger form submit when hitting enter:.

OnKeyDown="LaunchSubmit();".

It's ok in <input> fields, but I don't recommend to use it in textareas since people would submit the form if they'd hit enter for a carriage return when typing to the textarea...

Comment #7

Thanks for that jon, it works perfectly. Why do you have reservations about using this as a method? And why will I run into problems using the same name as class?.

Also, could you take a look at my other post about my menu script? not sure if it's ok or not - appreciate any advice on improvements (i.e. it'll name things the same as their class!).

Ta muchely, and thanks again,.

Iain.

Oh, also, I modified the code you suggested slightly, by instead putting onchange="consultants.button.focus();", where consultants is the name of the form, and button the name of the button. How does the "this.etc" work? I see it quite a lot but don't understand what it's referring to, or how it works...

Comment #8

As a rule, steer clear giving things the same name as a html or javascript keyword..

For instance, if you have.

<select name="select"> then how do you select this method via script? The normal answer is to use the select() method, but if you say form.select.select() then weird things will happen. You see it a lot when people name a button 'submit' <button name="submit">. Then, when they try to submit the form, by form.submit(), the browser complains - as you cannot execute a button!.

Get in the habit of prefixing the name by the element type, as in selSelect or btnSubmit..

This.

Is a reference to the current object. In the case of a control (form element), then there will also be a.

This.form.

Object, which is a reference to the parent form..

Http://developer.netscape.com/docs/m...s.html#1043482..

Comment #9


This question was taken from a support group/message board and re-posted here so others can learn from it.