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 3852406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:18:49+00:00 2026-05-19T17:18:49+00:00

I have a field being updated by jeditable. I want to output a warning

  • 0

I have a field being updated by jeditable. I want to output a warning message before submitting updates if the value is being reduced (which would result in data being lost), but not if it’s being increased.

This seems a good candidate for jeditable’s onsubmit function, which I can trigger happily. I can get the new value from $(‘input’, this).val(), but how do I get the original value to which to compare it in this context?

…

Since posting the above explanation / question, I’ve come up with a solution of sorts. By changing the invokation in jquery.ready from

$('#foo').editable(...);

to

$('#foo').hover(function(){
  var old_value = $(this).text();
  $(this).editable('ajax.php', {
     submitdata {'old_value':old_value}
  });
});

I can use settings.submitdata.old_value in the onsubmit method.

But there surely has to be a better way? jeditable must still have the old value tucked away somewhere in order to be able to revert it. So the question becomes how can I access that from the onsubmit function?

Many thanks in advance for any suggestions.

  • 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-19T17:18:49+00:00Added an answer on May 19, 2026 at 5:18 pm

    Here is my editable (it is using the submitEdit function):

       $(function () {
            $('.editable').editable(submitEdit, {
                indicator: '<img src="content/images/busy.gif">',
                tooltip: '@Html.Resource("Strings,edit")',
                cancel: '@Html.Resource("Strings,cancel")',
                submit: '@Html.Resource("Strings,ok")',
                event: 'edit'
            });
            /* Find and trigger "edit" event on correct Jeditable instance. */
            $(".edit_trigger").bind("click", function () {
                $(this).parent().prev().trigger("edit");
            });
        });
    

    In submitEdit origvalue is the original value before the edit

        function submitEdit(value, settings) {
            var edits = new Object();
            var origvalue = this.revert;
            var textbox = this;
            var result = value;
    
            // sb experiment
            var form = $(this).parents('form:first');
            // end experiment
    
            edits["field"] = form.find('input[name="field"]').val();
            edits["value"] = value;
            var returned = $.ajax({
                url: '@Url.Action("AjaxUpdate")',
                type: "POST",
                data: edits,
                dataType: "json",
                complete: function (xhr, textStatus) {
                    // sever returned error?
                    // ajax failed?
                    if (textStatus != "success") {
                        $(textbox).html(origvalue);
                        alert('Request failed');
                        return;
                    }
    
                    var obj = jQuery.parseJSON(xhr.responseText);
                    if (obj != null && obj.responseText != null) {
                        alert(obj.responseText);
                        $(textbox).html(origvalue);
                    }
                }
            });
            return (result);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CSV has field that is being parsed which may or may not have entries
I have field like a_b_c_d I want as the output a b c_d, this
I have a custom UserType which stores a date/time value in a TIMESTAMP field
I have field that it's not a key (it's text) and I want to
in my jqgrid i have field in a table which represents the id and
In my class, I have field int count . I want to create a
I have been struggling with getting a field value change to commit. Is there
I have an input, type text, element which is being validated using MVC3 validation
So I have a notes field that is getting one row (assigned_user_id) updated to
I have 4k records in access database. And one of the field value contains

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.