views:

49

answers:

1

This is in continuation of

http://stackoverflow.com/questions/1613744/how-to-attach-an-event-to-onsubmit-event-of-form-with-chaining-earlier-attached-m

Now, i am having disablePage method which will be executed every time there is any submit event occurs. But i don't want this method to execute if the event is generated from export button.

<input type="submit" name="_export" id="btnExportID"  />

How can i handle this?

+1  A: 

quick-n-dirty: declare a variable var exportClicked set it on click of _export button. in disablePage check if the source is _export and pass it.

function disablePage(){
    if(exportClicked){
        exportClicked=false;
        return;
    }

   //block page...
}

.

<input type="submit" name="_export" id="btnExportID" 
       onclick="exportClick();" />

function exportClick(){
    exportClicked = true;
    document.getElementsByTagName('Form')[0].submit();
}
TheVillageIdiot
though it is dirty, but i guess this is the only solution.
Rakesh Juyal
let's see if someone can come with something cleaner.
TheVillageIdiot