I love the Form.request method.  But in pursuit of Javascript-fu,  
I've come up with an interesting (to me) idea.  I often have a  
situation where I'm hijacking a set of forms on a page, like anything  
with the class 'new', and performing an Ajax request on the form.   
Usually I would also use several of the callbacks, but here's a  
trivial example that disables the form during the request.

$$('form.new').each(function(form) {
   form.observe('submit', function(event) {
     form.request({evalScripts: true,
       onLoading:function() { form.disable(); },
       onComplete:function() { form.enable(); }
     });
   }
});

But there are usually some forms where I want to do a little more.   
For example, for a form that is hidden by default, I want to hide it  
again after the form is submitted.  What would be really cool is to  
be able to register "observers" on the form's Ajax object:

$$('form.hidden').each(function(form) {
   form.request.observe('success', function() {
     new Effect.BlindUp(form);
   });
});

What does everyone think of this idea?  I haven't thought about the  
implementation all all, so the given syntax probably wouldn't work,  
but you get the idea.

Thanks,
Brandon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to