开发者

Different popup for textbox change?

I have 10 textboxes in Company page. 5 of them are common in Location page. My goal is to ask user if he wants to update 开发者_JAVA技巧just company page or even location page. If the user changes 5 textboxes that are common in Location Page, the popup shows as "Do you want to update Location Page as well" or if the user changes the other 5, then popup shows "Do you want to save?"

How do we determine what textboxs are changed and which popup should be shown?? Could someone help me out. Thanks all :)


One of the methods is:

  1. install jquery (just for easier access to controls)
  2. assign a className like class='common' to the first set of textboxes
  3. assign another className like class='other' to the second set of textboxes
  4. handle onblur event for 'commons':

    $(":input.common").blur(function() {
      if ($(this).data("changed") && confirm("Do you want to update Location Page as well?")) {
        // TODO: perform update
      }
    }).keydown(function(e) {
      $(this).data("changed", true);
    }).focus(function(e) {
      $(this).data("changed", false);
    });
    
  5. handle onblur event for 'others':

    $(":input.other").blur(function() {
      if ($(this).data("changed") && confirm("Do you want to save?")) {
        // TODO: perform save
      }
    }).keydown(function(e) {
      $(this).data("changed", true);
    }).focus(function(e) {
      $(this).data("changed", false);
    });
    

Got an idea?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜