Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ofeargall, the problem seems to be in how you are binding the <code>submit</code> event to your form. I've refactored your code below for fun and also took the bind to submit function out side of <code>texteditor()</code>. Let me know if it works out or if you are still having troubles. I'm hoping that you understand why you are having the problem, if you don't after this, please feel free to ask further questions.</p> <pre><code>$(function() { $('#cancel').click(rebinder); $('.edit').click(texteditor); $('#texteditform').live('submit', function(e) { // stop the form submission e.preventDefault(); var $el = $(this /*, DOM_ELEMENT_PARENT */); var $theText = $('#theText', this); // change this? var newText = $theText.val(), // NOT USED: theParentID = $el.closest('div').attr('id'), theTag = this.tagName.toLowerCase(), theID = theName.split("-")[1], gateway = ("&lt;cfoutput&gt;#URL.page#&lt;/cfoutput&gt;"), // CFC $.post("cfc/engine.cfc?method=updateText&amp;returnformat=json", {text:newText, field:theID, gateway_id:gateway}, function(res) { // Handle the result if(res.trim() == "true") { $theText.attr('value', ''); location.reload(); // $('.edit').bind('click'); } else { alert("Didn't Work"); } } ); }); function texteditor() { var $el = $(/* DOM_ELEMENT_WITH_EDITABLE_TEXT, DOM_ELEMENT */); var theName = $el.attr('name'), textToEdit = $el.html(), fieldDims = [$el.css('width'), $el.css('height')]; $('#theText, #texteditform').attr('value', textToEdit ) .css({ 'height' : fieldDims[1], 'width' : fieldDims[0] }); // you should make only current .edit unbound, and autocancel // when other .edit is clicked (and by cancel -- change to just // temporary disabling the form (hiding, etc.) such that the // text edits are saved if same .edit is clicked later $('.edit').unbind('click'); } function rebinder() { // alert('rebinder'); $('.edit').click(texteditor); $('#theText, #texteditform').attr('value', '') .css({ 'height' : '', 'width' : '' }); } }); /* END */ </code></pre> <p>Please keep in mind there are most definitely problems with the code, it's not meant to just be copy pasted. You should look it over and make sure you understand why I changed certain things in my quick check of it. Please point out fixes. Good luck.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload