The triggered function should receive two arguments (in this case).
The first one is the fake event, the second one is the new data item.
Let me know if this is not the case.
--John
On 9/11/06, Choan C. Gálvez <[EMAIL PROTECTED]> wrote:
> Hi all.
>
> I'm developing a validation system which involves custom events
> handling. That is, I want to execute some code before the validation
> and some code after the validation.
>
> So, my `$.fn.validate` looks like this (simplified):
>
> $.fn.validate = function(callback) {
> return this.each(function() {
> var res;
> var $this = $(this);
> $this.trigger("beforeValidate");
> res = validationExecution(); // edited to simplify
> $this.trigger("afterValidate", [res]); // <-- look at this
> line
> });
> };
>
> Trouble is, while the `$("something").trigger("event", data)` allows
> passing extra data to the handler (as seen inside `$.fn.trigger` and
> `$.event.trigger`), the handler function receives just a param, which
> is the real-or-fake event.
>
> Reason to want this feature is that the `afterValidate` handler must
> know if the validation has been succesfull to proceed in one of two
> manner (succesfull/unsuccesfull).
>
> Any workaround for this? Should I create a ticket?
>
> --
> Choan
> <http://choangalvez.nom.es/>
>
> Dizque. Desarrollo web y pequeñas dosis de vida real
> <http://dizque.lacalabaza.net>
>
> Mundo Du. Cuentos breves, relatos sorprendentes
> <http://du.lacalabaza.net/>
>
> Scriptia. Javascript y buenas prácticas
> <http://scriptia.net/>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
--
John Resig
http://ejohn.org/
[EMAIL PROTECTED]
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/