| View previous topic :: View next topic |
| Author |
Message |
optomeb
Joined: 19 May 2006 Posts: 113
|
| I want to have a text-input node respond to me pressing 'enter' without making it a form... |
| |
|
|
|
|
ovigo22
Joined: 15 May 2006 Posts: 130
|
| OnKeyUp or something |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| Why not make it a form? |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| Define "respond" |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
| Onkeyup |
| |
|
|
optomeb
Joined: 19 May 2006 Posts: 113
|
| I dont need it, and dont want it to reload the page. Klimapol: respond as in simulate a button-click |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
| = someFunction that will check if it was enter... and then if so do something |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| What happens when the button is clicked though? |
| |
|
|
optomeb
Joined: 19 May 2006 Posts: 113
|
montanarry, k, 'll try that
Klimapol, it works ;-P |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| What works how? |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| optomeb, If you want it to get data, then you should use a form. Ever heard of gracefull fallback? |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| You keep glossing over the important part |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
| optomeb, you dont have to use a form just the <input> but i suggest you use a <form> and <input > in it |
| |
|
|
optomeb
Joined: 19 May 2006 Posts: 113
|
| montanarry, how can I not let it reload the page when using a form? |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
.. dont put the Submit stuff  |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| You can catch the submit event, cancel it, and then use XHR instead |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
| Or not even put it |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| Of course then you need a protocol for recieving feedback via XHR and knowing what to do with it |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
| I dont know if they do submit if you wont put a <input type=SUBMIT> |
| |
|
|
Koplaf
Joined: 28 May 2006 Posts: 130
|
optomeb, You could set it up so that if the user has JS, then the submit action gets blocked, but you does some XMLHTTPReq stuff to get the job done.
If there is no JS, then the submit will do it's magic. |
| |
|
|
|
|
optomeb
Joined: 19 May 2006 Posts: 113
|
| Action is required according to w3 |
| |
|
|
Koplaf
Joined: 28 May 2006 Posts: 130
|
| On the server side, you'll hook them into the same functions, so you won't haveot know the difference. |
| |
|
|
montanarry
Joined: 13 May 2006 Posts: 175
|
optomeb, then also put onSubmit="return false"
Or something like that
but i dont know exact |
| |
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
montanarry, no
you'd attach an event listener
Cancel the event
And then do XHR stuff instead
Of course then you have to know how to use XHR and what to do with the response |
| |
|
|
| Page 1 of 3 |
Goto page 1, 2, 3 Next |
|