Topic: RJS errors?

We have the following code in a .rjs file

page.replace_html 'ndus_not_assigned', :partial => "ndus_not_assigned"
page.call "Toggle_Add_Ndu('new_ndu')"
page.visual_effect :highlight, 'ndu_list'

And this function in our application.js file.

# edit_pub is the form name and new_ndu_value is the text field name
function Toggle_Add_Ndu(el_id)
{
    Element.toggle(el_id);
    document.edit_pub.new_ndu_name.value = "";
}

The replace_html call works fine and the custom function executes (ie clears and hides the form field, but in an alert we get the following followed by a dump of the ajax response in another alert window...

RJS error:
TypeError: "Toggle_Add_Ndu('new_ndu')" is not a function


Any ideas where this could be coming from?

Last edited by rburbach (2007-08-30 14:13:44)

Re: RJS errors?

Try

page.call "Toggle_Add_Ndu", 'new_ndu'

instead.

Re: RJS errors?

Thanks, that worked, didn't think to try something like that! page.call is new to me smile

the visual_effect still doesn't fire, but that is prob a different issue...

Re: RJS errors?

Visual effect should still fire, make sure that you are putting something in the div or the div actually exists (if it doesn't exist it should give an error)