bernat / best_in_place

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
1.2k stars 574 forks source link

Works but fails to show the updated value automatically and returns some JS errors in console #571

Open acrolink opened 7 years ago

acrolink commented 7 years ago

I have implemented best_in_place for a number field inside my Rails app. The inline editing works, it updates the field in the database but fails to show the updated value (i.e. I need to reload the entire page to display the updated value). Moreover, inspecting the Chrome console shows the following:

Form submission canceled because the form is not connected
PUT http://my-site.com/projects/5 500 (Internal Server Error) ... jquery.self-bd7ddd3….js?body=1:10255

Any idea what might be happening here? Thank you.

acrolink commented 7 years ago

UPDATE

I have managed to eliminate the 500 error by modifying show.json.jbuilder from:

json.partial! "projects/project", project: @project

to:

json.(@project, :id)

I am still getting the Form submission canceled because the form is not connected warning.. But it looks like everything is working as it should now.

victorhazbun commented 7 years ago

Is this gem working on Rails 5?

acrolink commented 7 years ago

@victorhazbun Yes it does.

duffyjp commented 6 years ago

Hi @acrolink, I'd suggest changing the title of this post to reflect just the Chrome warning message: https://stackoverflow.com/questions/42053775/getting-error-form-submission-canceled-because-the-form-is-not-connected

According to the above Stack Overflow, the warning was added in version 56. I'm on 59 now, and still get the message, although the forms aren't broken as reported by users of 56.

mirelon commented 6 years ago

Chrome 66, still getting this issue. It seems this gem is discontinued.

ronhornbaker commented 5 years ago

Chrome 68 here, still getting the "Form submission canceled because the form is not connected" warning in the console. Even though users should never see it, it's annoying.

It should be an easy fix: do something like e.preventDefault() on the form submission.