Hi In the view I have link_to_remote as below <%= link_to_remote( "Select", { :update=>"div_inside_transfer_reason_search_sd", :before=>"checkgroupselected($(''sd_ticket_primary_assignee_group_id''));", :url =>{ :controller => ''popup'', :action => ''transfer_reason'',:sd_ticket=>sd_ticket,}, :with =>"''transfer_reason=''+$(''transfer_reason''+#{div_no}).value ''&'' + ''primary_group_id=''+$(''sd_ticket_primary_assignee_group_id'').value", }) %> in the :before i am calling the javascript to check whether the value sd_ticket_primary_assignee_group_id is empty or not..What i need is if that field is not empty only controle goes to the action transfer_reason...Otherwise that is if it is empty I have to show a hidden div..And i tried javascript like <script> function checkgroupselected(group_id) { if(group_id.value==null || group_id.value=="") { return false; } } </script> But is not working...What may be the reason?Also is there any other method as a solution? Thanks in advance Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jun-03 09:30 UTC
Re: return back to the view after a javscript condition
On Jun 3, 9:32 am, Sijo Kg <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi > In the view I have link_to_remote as below > <%= link_to_remote( "Select", > { > :update=>"div_inside_transfer_reason_search_sd", > :before=>"checkgroupselected($(''sd_ticket_primary_assignee_group_id''));", > :url =>{ :controller => ''popup'', :action => > ''transfer_reason'',:sd_ticket=>sd_ticket,}, > :with =>"''transfer_reason=''+$(''transfer_reason''+#{div_no}).value ''&'' + > ''primary_group_id=''+$(''sd_ticket_primary_assignee_group_id'').value", > }) %> > > in the :before i am calling the javascript to check whether the value > sd_ticket_primary_assignee_group_id is empty or not..What i need is if > that field is not empty only controle goes to the action > transfer_reason...Otherwise that is if it is empty I have to show a > hidden div..And i tried javascript like > <script> > function checkgroupselected(group_id) > { > if(group_id.value==null || group_id.value=="") > { > return false; > } > > } > </script> > > But is not working...What may be the reason?Also is there any other > method as a solution? >Well you haven''t said in what way is it not working: is it continuing when it shouldn''t, stopping when it should continue etc... At the very least your checkgroupselected needs a return true in there, and you''ve got a syntax error in your :with option (missing a + before the &) and you''re not using encodeURIComponent so weird stuff will happen if either of those form elements include a & Fred> Thanks in advance > Sijo > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi It is working in the sense it is continuing..But i want not continuing if the script evaluates false Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Also all was working till adding :before clause Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---