[Kss-devel] how to prevent forms from submitting when I hit Enter?
Godefroid Chapelle
gotcha at bubblenet.be
Tue Apr 8 10:11:23 CEST 2008
Brandon Craig Rhodes wrote:
> In my experiments so far, I have had good luck shutting down
> submit-button actions by saying
>
> input#my-submit-button:click {
> evt-click-preventdefault: True;
> }
>
> so that my own actions can run instead, without the whole page
> reloading. But my careful deactivation of the submit button, it turns
> out, is useless if the user tries to activate the form by simply
> hitting "Enter" when they are doing typing their input.
>
> What's the right way, in KSS, to prevent an
>
> <input type=text ... />
>
> field from submitting the form that it's inside of when the user hits
> Enter? The only way I have found so far is to say, in my form itself,
>
> <form id="form1" onsubmit="return false;">
> <input id="input1" type="text" name="text1" />
> </form>
>
> But it's embarrassing during presentations, after telling people that
> KSS prevents them from having to write JavaScript, for them to see
> that in fact I've had to write JavaScript in every form that I've
> created in my application. ;-) What's the correct solution?
>
I suspect you found one of the places where KSS is still lacking the
right code.
Can you tell us in which browsers you experience the problem ?
This way we can explore it and try to fix the stuff asap.
--
Godefroid Chapelle (aka __gotcha) http://bubblenet.be
More information about the Kss-devel
mailing list