Javascript callback after form inserted for new element?

57 views
Skip to first unread message

Mike Blyth

unread,
Aug 28, 2012, 8:53:43 AM8/28/12
to actives...@googlegroups.com
I have a Javascript used on a new/edit form. It works fine when the formed is opened inline with edit, but it is not called with the new action (Create New). I'm not even sure why it works on edit, since it is activated with the document ready event. Anyway, I think what I need is an event triggered when that form is opened inline. Is there such an event? Any other method I can use to modify the form when it has been inserted? Thanks.

Sergio Cambra

unread,
Aug 28, 2012, 9:18:25 AM8/28/12
to actives...@googlegroups.com
On Martes, 28 de agosto de 2012 05:53:43 Mike Blyth escribió:
> I have a Javascript used on a new/edit form. It works fine when the formed
> is opened inline with edit, but it is not called with the *new* action
> (Create New). I'm not even sure why it works on edit, since it is activated
> with the document ready event. Anyway, I think what I need is an event
> triggered when that form is opened inline. Is there such an event? Any
> other method I can use to modify the form when it has been inserted? Thanks.

https://github.com/activescaffold/active_scaffold/wiki/Customizing-Forms-with-Javascript

To summarize:
$(document).on('as:action_success', '.your_controller-view a.new, .your_controller-view a.edit', function(e, action_link) {
custom code (action_link.adapter is the create/update view)
});


Mike Blyth

unread,
Aug 30, 2012, 8:32:22 AM8/30/12
to actives...@googlegroups.com
Perfect, thanks.
Reply all
Reply to author
Forward
0 new messages