I''m having issues handling output of a inplace editor function. When
the
controller action is successful, it returns the new value that populates the
DIV and all is well. When it fails, it sends a js alert to the user. The
problem is, after it sends the alert (and the user clicks OK) it then spits
back the try/catch javascript code which gets inserted into the DIV.
I''ve
tried returning false but it doesn''t do any good. I also
can''t render
:nothing => true because I get a ''double render error''
Any thoughts?
#in keyword_controller.rb
def set_bid
params[:value].gsub!(/[^\d\.]/, '''')
if params[:value].to_f == 0.0
render :update do |page|
page.alert(''You must enter a dollar amount, e.g. 23.22,
0.23'')
end
return false
end
@link = KeywordLink.find(params[:id])
previous = @link.max_bid
@link.max_bid = params[:value]
@link.max_bid = previous unless @link.save
render :text => help.number_to_currency(@link.max_bid)
end
#in view
<%= in_place_editor ''bid_'' + keyword.id.to_s,
:url => { :controller =>
''keyword'', :action =>
''set_bid'', :id => keyword.keyword_link.id } -%>
thanks,
ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/b52a4187/attachment.html