I've always found it easier to use evalScripts:true in the Ajax call
and spit back a script to call a function do do whatever I need.

On Jul 4, 10:20 am, cdams <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I looked into the web, and I find that this is a common error, but I
> haven't any solution..
>
> My method Ajax.Request is in another method. And for my function(v), I
> need to put a return, false or true.
> I tried with my script, but it doesn't work..
>
> Have you any idea to solve my pb?
>
> Thanks
>
> My script :
>
> var valid = new Validation('form-extra', {immediate : true});
> var resultat = false;
>
> Validation.add( 'validate-captcha', 'Captcha is wrong!', function(v){
>   new Ajax.Request( 'ajax_serve.php', {
>     method: 'get',
>     parameters: {
>       validate: v
>     },
>     onSuccess: function( transport ) {
>       if( transport.responseText.match(/true/)) {
>         $('captcha').removeClassName('validation-failed');
>         $('captcha').addClassName('validation-passed');
>         resultat = true;
>       } else {
>         $('captcha').removeClassName('validation-passed');
>         $('captcha').addClassName('validation-failed');
>         resultat = false;
>       }
>     }
>   });
>   return resultat;
>
> });
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to