Return back to the view after a javscript condition

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

But is not working…What may be the reason?Also is there any other
method as a solution?

Thanks in advance
Sijo

On Jun 3, 9:32 am, Sijo Kg [email protected] wrote:

}) %>
{
return false;
}

}

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

Hi
It is working in the sense it is continuing…But i want not
continuing if the script evaluates false

Sijo

Hi
Also all was working till adding :before clause
Sijo