Kad Kerforn wrote:
tseting an InPlaceEditor,
Please write automated tests for it, too...
I am trying the :onComplete option (code to
be run, if update successful with server)
even not fleunt with JS, I succeeded with an Ajax.RequestonComplete: function(transport,element) { new
Ajax.Request('/profils/change_domain_category/', {asynchronous:true,
evalScripts:true, parameters:'new_domain_name=' +
this.element.childNodes[0].nodeValue + '&old_domain_key=' + '#{value}'
});return false;},
Tip: Put into your View a hidden <A> field (using link_to_remote), and use onComplete to trigger it, with something like onComplete: function() { $('my_anchor_id').onclick(); }. I don't know if that would work, but I would start there, and it puts as much Ajax inside Ruby helper-generators as possible.
And I think you can lose the 'transport,element' if you are not using it...
I am trying a simpler function to remove a class name from the current
element :onComplete: function(transport,element){ new
removeClassName(this.element, 'red'); }"but it's wrong.... I got an error ( invalid property id) why ? how
should I write it correctly ?
What's 'this' at the time onComplete runs? Who runs onComplete?
Try $('my_explicit_id').