Re: onSubmit Handlers and Ajax

2006-12-28 Thread Jeremy Quinn

Hi All

Another question 

Currently, when onSubmit Handers are called, they are able to stop  
the form submit by returning false. OK so far.


However, if you have multiple handlers and say the middle one returns  
false, the ones after it, do not get called at all.


Is this the right behaviour? Or should all handlers be always called,  
returning false if one (or more) of them returns false.


i.e. onSubmit Handers should still be able to stop the form from  
submitting, but they should not be able to stop subsequent handers  
from being called.


WDYT ?

thanks

regards Jeremy


On 27 Dec 2006, at 18:14, Jeremy Quinn wrote:


Hi All

In 2.1.8, we called forms_onsubmitHandlers when Ajax forms were  
submitted.

In 2.1.9 we stopped doing that and only called them on non-Ajax forms.

I do not remember why this was done.

Anybody ?

thanks

regards Jeremy




smime.p7s
Description: S/MIME cryptographic signature


Re: onSubmit Handlers and Ajax

2006-12-28 Thread Carsten Ziegeler
Hmm,

I'm not sure - I haven't used onSubmit handlers so far as they did not
work with multiple forms :) So we are currently using our own handler
implementation. We mainly use them for client-site prevalidation like
checking for required fields etc. In this case I think it makes sense to
stop after the first failing handler.

So I think the current behaviour is fine :) But perhaps there are other
use cases? What about a chain implementation? So a handler can decide to
call the next handler or not?

Carsten

Jeremy Quinn wrote:
 Hi All
 
 Another question 
 
 Currently, when onSubmit Handers are called, they are able to stop  
 the form submit by returning false. OK so far.
 
 However, if you have multiple handlers and say the middle one returns  
 false, the ones after it, do not get called at all.
 
 Is this the right behaviour? Or should all handlers be always called,  
 returning false if one (or more) of them returns false.
 
 i.e. onSubmit Handers should still be able to stop the form from  
 submitting, but they should not be able to stop subsequent handers  
 from being called.
 
 WDYT ?
 
 thanks
 
 regards Jeremy
 
 
 On 27 Dec 2006, at 18:14, Jeremy Quinn wrote:
 
 Hi All

 In 2.1.8, we called forms_onsubmitHandlers when Ajax forms were  
 submitted.
 In 2.1.9 we stopped doing that and only called them on non-Ajax forms.

 I do not remember why this was done.

 Anybody ?

 thanks

 regards Jeremy
 


-- 
Carsten Ziegeler - Chief Architect
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/


Re: onSubmit Handlers and Ajax

2006-12-28 Thread Jeremy Quinn


On 28 Dec 2006, at 15:16, Carsten Ziegeler wrote:


Hmm,

I'm not sure - I haven't used onSubmit handlers so far as they did not
work with multiple forms :) So we are currently using our own handler
implementation.


Well hopefully this will be solved :)


We mainly use them for client-site prevalidation like
checking for required fields etc. In this case I think it makes  
sense to

stop after the first failing handler.


If I understand you correctly, I think I would prefer all pre- 
validation to occur even if there are validation errors found,  
otherwise user needs to fix-submit, fix-submit etc. to 'discover' the  
errors one by one. I would rather see all validation errors in one go.


So I think the current behaviour is fine :) But perhaps there are  
other
use cases? What about a chain implementation? So a handler can  
decide to

call the next handler or not?


Eeek! ;)

You have a usecase for this ?

Should an onSubmit Handler know if others exist ?
This is going to mean more api changes and more incompatibility  
issues for people with custom widgets. :(


Convince me ;)


And BTW. Can you think why onSubmit Handlers should no longer be  
called before Ajax submits (the original question) ?


best regards

Jeremy




Jeremy Quinn wrote:

Hi All

Another question 

Currently, when onSubmit Handers are called, they are able to stop
the form submit by returning false. OK so far.

However, if you have multiple handlers and say the middle one returns
false, the ones after it, do not get called at all.

Is this the right behaviour? Or should all handlers be always called,
returning false if one (or more) of them returns false.

i.e. onSubmit Handers should still be able to stop the form from
submitting, but they should not be able to stop subsequent handers
from being called.

WDYT ?

thanks

regards Jeremy


On 27 Dec 2006, at 18:14, Jeremy Quinn wrote:


Hi All

In 2.1.8, we called forms_onsubmitHandlers when Ajax forms were
submitted.
In 2.1.9 we stopped doing that and only called them on non-Ajax  
forms.


I do not remember why this was done.

Anybody ?

thanks

regards Jeremy





--
Carsten Ziegeler - Chief Architect
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/




smime.p7s
Description: S/MIME cryptographic signature


Re: onSubmit Handlers and Ajax

2006-12-28 Thread Carsten Ziegeler
Jeremy Quinn wrote:
 If I understand you correctly, I think I would prefer all pre- 
 validation to occur even if there are validation errors found,  
 otherwise user needs to fix-submit, fix-submit etc. to 'discover' the  
 errors one by one. I would rather see all validation errors in one go.
 
Ok, this depends on what you do in the handlers :) Now, we have the use
case where we display a popup telling the user what to fix...now if two
handlers open up a popup one after the other that's not that user
friendly I guess...but we could just use one single handler for this and
are done. No problem.

 So I think the current behaviour is fine :) But perhaps there are  
 other
 use cases? What about a chain implementation? So a handler can  
 decide to
 call the next handler or not?
 
 Eeek! ;)
:) I guessed you love it!

 
 You have a usecase for this ?
Nope, see my example from above. If we use one single handler for all
our prevalidation, we're fine.
 
 Should an onSubmit Handler know if others exist ?
 This is going to mean more api changes and more incompatibility  
 issues for people with custom widgets. :(
 
 Convince me ;)
Sorry, no :)

 
 
 And BTW. Can you think why onSubmit Handlers should no longer be  
 called before Ajax submits (the original question) ?
I have no idea - but I could imagine that the idea was to invoke the
handlers only if the form is really submitted and not for any form based
ajax requests. So I guess this is a bug then, but it's just a guess :)
I think this should be fixed if noone comes up with a good reason.

Carsten
-- 
Carsten Ziegeler - Chief Architect
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/


Re: onSubmit Handlers and Ajax

2006-12-28 Thread Jeremy Quinn


On 28 Dec 2006, at 16:12, Carsten Ziegeler wrote:


Jeremy Quinn wrote:

If I understand you correctly, I think I would prefer all pre-
validation to occur even if there are validation errors found,
otherwise user needs to fix-submit, fix-submit etc. to 'discover' the
errors one by one. I would rather see all validation errors in one  
go.


Ok, this depends on what you do in the handlers :) Now, we have the  
use
case where we display a popup telling the user what to fix...now if  
two

handlers open up a popup one after the other that's not that user
friendly I guess...but we could just use one single handler for  
this and

are done. No problem.


Or display errors in a less modal way?

BTW. Dojo is adding client-side validation to some of it's form  
widgets, I'll have a look at that stuff soon, to see if it would be  
useful in CForms.


see: http://archive.dojotoolkit.org/nightly/tests/widget/ 
test_validate.html





So I think the current behaviour is fine :) But perhaps there are
other
use cases? What about a chain implementation? So a handler can
decide to
call the next handler or not?


Eeek! ;)

:) I guessed you love it!



You have a usecase for this ?

Nope, see my example from above. If we use one single handler for all
our prevalidation, we're fine.


Should an onSubmit Handler know if others exist ?
This is going to mean more api changes and more incompatibility
issues for people with custom widgets. :(

Convince me ;)

Sorry, no :)


He he he he ;)


And BTW. Can you think why onSubmit Handlers should no longer be
called before Ajax submits (the original question) ?

I have no idea - but I could imagine that the idea was to invoke the
handlers only if the form is really submitted and not for any form  
based

ajax requests. So I guess this is a bug then, but it's just a guess :)
I think this should be fixed if noone comes up with a good reason.


I think I may have been confused about how dojo.event.connect  
'around' advice works.
Now I think maybe they are being called during Ajax submits, sorry  
for the noise.


best regards

Jeremy



smime.p7s
Description: S/MIME cryptographic signature