开发者

After the Deadline jQuery textarea removal

Our company has recently switched over to using After the Deadline for our spell checker. We love it's functionality, however, we've essentially had to hack it so that it will function on every page across various customers sites. Long-story short, I ended up using jQuery to apply the spell checker across every page.

The issue is that when you check the spelling and finish it, if you submit it's not passing the form field through the post. We're running Coldfusion and it simply says that the form variable doesn't exist.

Here's the code, it's really simple:

    function check(elId,linkId)
 {
    AtD.checkTextAreaCrossAJAX( elId , linkId, '<img src="http://www.curricunet.com/images/accept.png" />Finish Checking'开发者_运维问答);
 };

I'm thinking that there is something wrong with the jQuery plugin that they provide. After the Deadline jQuery plugin. I've been pouring over their plugin (in the src folder they have an unminified version.) I can't seem to find the issue. They don't have very good support on their site for this kind of thing.

Can you guys think of any reason why it would be removing the textarea from the form?

Here's the function that I think is breaking the code (at least in Firefox and Chrome):

AtD.restoreTextArea = function(id) {
    var options = AtD.textareas[id];

    /* check if we're in the proofreading mode, if not... then retunr */
    if (options == undefined || options['before'] == options['link'].html())
        return;

    /* clear the error HTML out of the preview div */
    AtD.remove(id);

    /* clear the AtD synchronization field */
    jQuery('#AtD_sync_').remove();

    /* swap the preview div for the textarea, notice how I have to restore the appropriate class/id/style attributes */

    var content;

    if (navigator.appName == 'Microsoft Internet Explorer')
        content = jQuery('#' + id).html().replace(/<BR.*?class.*?atd_remove_me.*?>/gi, "\n");
    else
        content = jQuery('#' + id).html();

    jQuery('#' + id).replaceWith( options['node'] );
    jQuery('#' + id).val( content.replace(/\&lt\;/g, '<').replace(/\&gt\;/, '>').replace(/\&amp;/g, '&') );
    jQuery('#' + id).height( options['height'] );

    /* change the link text back to its original label */
    options['link'].html( options['before'] );
};


In checking out their demo on textareas http://www.polishmywriting.com/atd-jquery/demo2.html

if you look at the rendered page in Firebug, when you click on the spell check button the textarea is being replaced with an editable div and a hidden form field with a generated id

<div contenteditable="true" id="textInput" style="height: 194px; overflow: auto; white-space: pre-wrap; outline: medium none; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 16px; font-family: times; border: 1px solid rgb(0, 0, 0); text-align: start; margin: 2px; width: 394px; line-height: 20px; letter-spacing: normal; left: auto; right: auto; top: auto; bottom: auto; position: static; padding: 2px;" class="input" spellcheck="false">text</div>

<input type="hidden" id="AtD_sync_" value="The purpoce of a spell checker is to check the text four spelling and typeing errors. The checker finds errors througout the text. When the spell checker finds an questionable word, it highlights it and suggests the mpst likely variants too replace the questionable word. You can select the variant and replace the wrrd or leave the word unanged." name="">

Is the form being submitted without re-clicking your spell check button (turning it back into a textarea)? That would explain why the field doesn't exist on the POST. You might have to simulate the logic that converts back on the submit handler of the form

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜