codedance / jquery.AreYouSure

A light-weight jQuery "dirty forms" Plugin - it monitors html forms and alerts users to unsaved changes if they attempt to close the browser or navigate away from the page. (Are you sure?)
507 stars 145 forks source link

default field selector #69

Open gavinreid2004 opened 9 years ago

gavinreid2004 commented 9 years ago

I had an issue when I set addRemoveFieldsMarksDirty to true in IE 11. I had button tag

SMohanraj commented 9 years ago

How to assign asp.net control to default fieldSelector to ":input:not(input[type=submit]):not(input[type=button]):not(button)"

Can you help me....

gavinreid2004 commented 9 years ago

when setting up areYouSure you can pass the options object in with fieldSelector property set to the value you want. For example $('#myform').areYouSure({ 'addRemoveFieldsMarksDirty': true , fieldSelector: ':input:not(input[type=submit]):not(input[type=button]):not(button)'});

SMohanraj commented 9 years ago

Thanks for your reply.

I want to bind click event with this input [Html/asp.net] control ..

$('#frmRegBegin').areYouSure({ 'message': 'Your profile details are not saved!', 'addRemoveFieldsMarksDirty': true, 'fieldSelector': "input:not(input[type=submit] [value=submit] [id=Submit1] [onclick=callme()]):not(input[type=button][id=Button1])" });

    function callme()
    {
       //do saving changes.
   }

I tried its throws error: "JavaScript runtime error: Syntax error, unrecognized expression: input:not(input[type=submit] [value=submit] [id=Submit1] [onclick=callme()]):not(input[type=button][id=Button1])"

gavinreid2004 commented 9 years ago

in my code my field selector starts with a : ":input:not(....

SMohanraj commented 9 years ago

How to avoid to display "Leave on the page" , "stay on the page"