Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3346308
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:17:17+00:00 2026-05-18T01:17:17+00:00

[See update for a more precise specification …] I recently started using the jquery

  • 0

[See update for a more precise specification …]

I recently started using the jquery jeditable plugin for my asp.net mvc app. So far so good.

The last post at http://forums.asp.net/p/1541654/3789265.aspx has been incredibly useful and I ended up using it almost verbatim. However, the modeled error behavior is not quite right for my application. In case of an error, they throw away the change, revert the editable region to plain text, and pop up the error message as an alert. That’s fine for short input but unacceptable for longer textarea input.

My question: how can I change the onerror function to revert the editable area to a form seeded with the rejected input to allow for continuous edits?

I guess as a starter I should remove the call to original.reset() but I am not sure what else to call to throw out the placeholder and revert the form.

<h2 class="editable_area" id="Report_Title_<%: Model.report.ReportID %>"><%: Model.report.Title %></h2>
<div class="editable_area" id="Report_HeaderText_<%: Model.report.ReportID %>"><%: Model.report.HeaderText %></div>

<script type="text/javascript" src="../../Scripts/jeditable/jquery.jeditable.js"></script>
<script type="text/javascript">
    $(function () {
        $('.editable_area').each(function (index, element) {

            // Get the property name and menu item id for the AJAX request  
            var identifiers = $(element).attr('id').split('_');
            var target = identifiers[0];
            var property = identifiers[1];
            var id = identifiers[2];

            $(element).editable('/' + target + '/UpdateSettings', {
                name: property,
                submitdata: function (value, settings) {
                    return { 'id': id, '__property': property };
                }, 
                onerror: function (settings, original, xhr) {  
                    var error = eval('(' + xhr.responseText + ')');
                    // This will be reverted by reset. 
                    // $('<span class="field-validation-error">' + error.Message + '</span>').appendTo($(this));  
                    alert(error.Message);  
                    original.reset();  
                },  
                type: 'textarea',
                rows: '10',
                cancel: 'Cancel',
                submit: 'OK',
                indicator: 'Saving...',
                tooltip: 'Click to edit...'
            })
        });
    });
</script>

Thanks,
Duffy

[Update] Looks like the trick involves to avoid setting an indicator, then during onerror refocus on the input field.

Unfortately my partial solution for onerror only works on IE. On firefox, focus() gets caught up in an “ajaxError” event.

           $(element).editable('/' + target + '/UpdateSettings', {
                [...]
                onerror: function (settings, original, xhr) {
                    $('.editable-field-validation-error').remove();
                    var error = eval('(' + xhr.responseText + ')');
                    $('<span class="editable-field-validation-error">' + error.Message + '</span>').prependTo($(this).parent());
                    // This works on IE but not on FireFox due to "ajaxError" event.
                    $(':input:visible:enabled:first', $(this)).focus();
                },
                // indicator: 'Saving...',
                onblur: 'cancel'
            })

Question: how to I prevent the focus and ajaxError events from getting tangled up?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:17:18+00:00Added an answer on May 18, 2026 at 1:17 am

    Well, as it turns out the snippet posted in the update above was correct after all. All it took for it to work was a restart of the browser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: False alarm! The source of the error was elsewhere. (See at the end
Bug reported as fixed by Apple, see accepted answer below ... UPDATE MON AUG
See this previous question for some background. I'm trying to renumber a corrupted MPTT
I've two or more projects (let's call them ProjectFoo and ProjectBar ) having some
**Update: Title should have read: Sql Query - Unique item with latest entry Hi
Is it possible to see the DML (SQL Statement) that is being run that
I am having issues while passing objects across Appdomains.During further investigation I found that
We have a web application (it is a game) with lots of various forms
I have a ListView with a CheckBox as one of the columns, bound to
I'm experimenting with the Doctrine ORM (v1.2) for PHP. I have defined a class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.