try {
Element.replace("textSearchLink", "<a href=\"#\" onclick=\"new
Ajax.Request('/searches/54', {asynchronous:true, evalScripts:true,
parameters:Form.serialize('textSearchFieldset')});
return false;\">Add</a>");
Element.replace("materialPropertySearchLink", "<a href=\"#\"
onclick=\"new Ajax.Request('/searches/54', {asynchronous:true,
evalScripts:true,
parameters:Form.serialize('materialPropertySearchFieldset')});
return false;\">Add</a>");
Element.replace("metalCompositionSearchLink", "<a href=\"#\"
onclick=\"new Ajax.Request('/searches/54', {asynchronous:true,
evalScripts:true,
parameters:Form.serialize('metalCompositionSearchFieldset')});
return false;\">Add</a>");
new Insertion.Bottom("searchCriteriaDiv", "<p>\n <a href=\"#\"
onclick=\"new Ajax.Request('', {asynchronous:true, evalScripts:true});
return false;\">Remove</a>\n
<label>keyword2</label>\n</p>");
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('Element.replace(\"textSearchLink\", \"<a href=\\\"#\\\" onclick=
\\\"new Ajax.Request(\'/searches/54\', {asynchronous:true,
evalScripts:true, parameters:Form.serialize(\'textSearchFieldset\')});
return false;\\\">Add</a>\");
\nElement.replace(\"materialPropertySearchLink\", \"<a href=\\\"#\\\"
onclick=\\\"new Ajax.Request(\'/searches/54\', {asynchronous:true,
evalScripts:true,
parameters:Form.serialize(\'materialPropertySearchFieldset\')});
return false;\\\">Add</a>\");
\nElement.replace(\"metalCompositionSearchLink\", \"<a href=\\\"#\\\"
onclick=\\\"new Ajax.Request(\'/searches/54\', {asynchronous:true,
evalScripts:true,
parameters:Form.serialize(\'metalCompositionSearchFieldset\')});
return false;\\\">Add</a>\");\nnew Insertion.Bottom(\"searchCriteriaDiv
\", \"<p>\\n <a href=\\\"#\\\" onclick=\\\"new Ajax.Request(\'\',
{asynchronous:true, evalScripts:true}); return false;\\\">Remove</a>\
\n <label>keyword2</label>\\n</p>\");'); throw e }
For now, I'm using the option[:complete] to evaluate the above script,
so the link should be like:
<%= link_to_remote 'Search', { :url => searches_path, :submit =>
'textSearchFieldset', :complete => 'eval(request.responseText)' },
{ :id => 'textSearchLink' } %>
This does work, but the script should be evaluated automatically other
than using :complete => 'eval(...)'.