On Mon, 07 Apr 2008 21:27:21 -0400, 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;
> }


> 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,

If you want to prevent a form from submitting, you would probably need 
to bind a "submit" event on the form tag, with evt-preventdefault. That 
would be, imo, equivalent to your current javascript fix.

We have not noticed so far what you point out, and have probably never 
used this event. However, when we implemented the inline editing, we 
noticed that browsers behave unexpectedly with the keypress/down/up event 
and Enter in the submit field. In some cases preventing the form submit 
was rather tricky. This is not because of kss itself but because of 
browser madness: once we have a good pattern that works in javascript, we 
can improve support for it in kss as well.

So first of all it would be great if you could look at the 
"preventdefault" demo in kss.demo. It would be interesting to see if what 
you see is in line with your experience. It is especially interesting to 
run this demo on Safari.

Then, it would be great if you could create another demo that presents 
the solution for your current problem. You could also extend the 
"form_submit" demo if you like since it already has the html. This way 
the solution you work out could be presented publicly, and we could also 
test that it works on all browsers.

If you could help with this, it would be great. Please let me know on irc 
if you need any help.

-- 
Balazs Ree

_______________________________________________
Kss-devel mailing list
Kss-devel@codespeak.net
http://codespeak.net/mailman/listinfo/kss-devel

Reply via email to