On Aug 1, 7:35 am, serenobs <[email protected]> wrote:
> Hello.
>
> I tried to invoke javascript in the controller, but I couldn't.
>
> What I want to do is,
> I'd like to verify passed parameters in the controller,
> if parameters are not verified I'd like to invoke alert with error
> message and back to othere function.
>
> code will be like below
>
> if verify? params[:value]
> #call alert('value is not correct') <- how can I implement this
> function?
> redirect_to :action => 'index'
> return
> end
>
> how can I implement that function?
Unless you're dealing with an ajax request, you can't.
> can I insert javascript function before and after of redirect_to
> action?
>
> and my second question is
>
> <script>
> var foo = new myclass {
> function open() {
> }}
that doesn't look like legal javascript to me.
Fred
>
> </script>
> <%= link_to_remote 'click me', :update=>'blah'. :url=>
> {:action=>'something'}, :before=>'foo.open();' %>
>
> When I clicked, javascript error occured, "foo is not defined"
> if javascript is like "alert('blah');" it works.
> Maybe local and global is the difference while I'm not sure.
>
> anyway, how can I invoke javascript object that is not gloal object?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---