Click here to Skip to main content
12,750,464 members (36,167 online)
Rate this:
Please Sign up or sign in to vote.
Hi friends please help me

Currently I am working on InfoPath 2010 and got stuck up in one functionality and asking for your help.

Client Requirement :-
• Client is asking for “Is Dirty” functionality in an Browser based InfoPath 2010 form as well “Is Dirty” functionality for the below points
1. Browser back button click.
2. Browser refresh.(i.e. by pressing F5 or ctrl F5)
3. Browser close.
• If any control/s value changes on the InfoPath form then all the above points should work.

Currently Developed Scenario:-
• As we know there is not OOB Is Dirty functionality available in InfoPath 2010 and also by clicking Add Document on the form library by default it gets redirected to /_layouts/FormServer.aspx page, since it’s an application page we should not do anything here so I had copied the FormServer.aspx page and added a new page saying CustomFormServer.aspx and on click on Add Document redirecting it to my CustomFormServer.aspx page
• I have written my Custom J-query/JavaScript in this page (i.e. using one of the available J-query plugin for Is Dirty functionality which is available here)

Issue/Problem in using the above J-query plugin:-
• The above plugin is working properly but it does gets fired on the click of my Submit and Cancel button also(i.e. two buttons added for saving and cancelling, through InfoPath designer) which I don’t want since save button has my custom code for saving the information into various list and libraries and cancel button is just redirecting to allitems.aspx for that form library.
• So what I did is added the below J-query


$('input[type="button"]').click(function() {
where setClean will remove isdirty functionality from all the buttons on the entire InfoPath form

• The problem is, its works well when the page is loaded for the first time and as we know if we change any control value on InfoPath page it causes post back and the added J-query function doesn’t get fired. The detailed of this issue is also posted by me on MSDN forum here.

I know that I am troubling you but can you please provide your valuable feedback if possible, for the above issue or some workaround which can help me in satisfying the client requirement.

Waiting for an response from you.


• I am using Jquery on button click in InfoPath 2010 but if any filed/s value changes on the form then InfoPath form itself causes postback and the jquery function does'nt get fired(except for the time when the page does not cause any postback).
My thinking is like that after each postback the Jquery function is getting erased or removed which was applied on page load.
Is there any functionality which can help me triggering the same jquery function again after each postback ?
I tried adding following script:
function LoadHandler() {
But this is not working on page load as well on postback.
I also tried:
function pageLoad(sender, args) {
setTimeout(ready, 1000);
This is working only once when page loads for the first time and not on postback.
Posted 20-Nov-12 20:04pm
Updated 20-Nov-12 20:20pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Finally I found a solution by using the below code

$("input[buttonid='btn_Cancel']").live("mousedown", function() {

.live helps to attach the same jquery function back to the button and mousedown since I am already using click event for some different purpose and want some alerts to be fired before the button click event gets fired.
the order in which any input button events that gets fired are
1) mousedown
2) click and then
3) mouseup.

Hope this helps anyone who's facing the similar issue.

Happy coding :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170215.1 | Last Updated 5 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100