I'm using the best_in_place gem on several textareas and sometimes (seemingly randomly) the textarea 'jumps' and triggers the blur event when I click save, prompting the "discard your changes" warning.
Here's the code:
<p>
Administrator Notes (<%= link_to 'Edit', '#', id: 'edit_notes_link', onclick:
'event.preventDefault()' %>)
</p>
<div class="panel radius">
<%= best_in_place [:admin, @booking], :notes, type: :textarea, ok_button:
'Save', cancel_button: 'Cancel', activator: '#edit_notes_link', display_with:
:simple_format, nil: '<i>None</i>' %>
</div>
And here's a GIF of the behaviour:
(And the video that GIF was taken from)
I'm guessing that there's some JavaScript skulduggery going on somewhere but I don't know where to begin debugging it. If you've seen Best in Place behave like this or you have some pointers for how to debug it then I'd really appreciate some help.
If you are using firebug try turning on log events to get more information. Here is an article explaining it http://www.softwareishard.com/blog/firebug/firebug-tip-log-dom-events/
I was running into the same issue, and just removed the ok_button
. It seems to be working fine now.
I haven't used best-in-place gem but I had a similar requirement. I've used x-editable
Worked really well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With