-
Notifications
You must be signed in to change notification settings - Fork 18
updating field on submit #9
Comments
Can you give a bit more context? If you can paste your view and controller code I can probably be more helpful. Also, is the request returning with a status of 200 (you can check this in your Rails log, and/or with the Firebug Net tab (or equivalent)). |
Code is for a polymorphic address object. On submit works, the data is submitted to the database and upon browser refresh the updated information is displayed. However, it doesn't refresh/update the divs that have been updated upon submit. No status 200. ----View---- <%= editable_field address, :street, :cancel => 'Cancel', :submit => 'Submit', :indicator => '"<img src="/images/loader.gif>"', :tooltip => 'Click to edit...' %> <%= editable_field address, :city, :onblur => 'submit' %> <%= editable_field address, :state %> <%= editable_field address, :zip %> <%= editable_field address, :type %>
<% end %> ---Controller---
end PUT /notes/1PUT /notes/1.xmldef update
end def destroy
end |
So I think the problem is that the new value is not being returned from the format.html {
if request.xhr?
render :text => params[:resource].values.first
else
redirect_to(@resource, :notice => 'Resource was successfully updated.')
end
} Now realizing it really needs a helper method or something provided by the gem to make it cleaner... I'm open to suggestions about how to do this, but will take a stab at it in the next few days and try to get it out asap. Thanks for putting this through it's paces! |
Thank yo uso much for all your work on this. I think it is a great gem. I'll think on the helper method as I continue to work with it. Thanks again for your quick response. |
I added the following helper method to application_controller.rb def respond_to_jeditable resource
if request.xhr?
render :text => params[resource].values.first
true
else
false
end
end And use it in my controllers this way: def update
@job.update_attributes(params[:job])
respond_to_jeditable(:job) || respond_with(@job)
end |
Updated README with controller code documentation mentioned in Issue #9
I have plugin working properly (data is being submitted), but my dom elements aren't updating dynamically upon submit. Am I missing an option for the field to update?
The text was updated successfully, but these errors were encountered: