SleeplessKnight
SleeplessKnight

Reputation: 2185

how to judge a page edited or not from server client

a input asp.net page,you can image many input fields and a button named submit on it. before user submit the page ,I want to compare all the fields values with default values . if anyting didn't change ,i will give him a message. here it is the question: how to judge a page edited or not from server client(in button click event)?
i don't want compare each field in page.

Upvotes: 0

Views: 32

Answers (1)

Shad
Shad

Reputation: 15461

If you can use jQuery, it's pretty straight forward:

$(RELEVANT_FORM).submit(function(){
    var Proceed=false;
    $(this).find('input').each(function(i,E){
        Proceed=Proceed || $(E).val()!=$(E).attr('defaultValue');
    });
    if(!Proceed){alert('You havent done anything');return false;}
    return true;
});

Upvotes: 1

Related Questions