Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

Resetting a javascript value on successful save

I am setting a javascript isDirty value to 1 if a change is made in the fields on a form. If the user cilcks a menu item or link that would take them away, I detect if the value is 1 and alert to save.

However, if they press the SAVE button on the page, and the save is successful, I want to reset the value to 0, so that if they click away again, it won't alert them to save again, because they have already saved.

How do I get my .NET code after I determine the save is successful, to then go in and change the isDirty value back to 0?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of xoperator
xoperator
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I hope i understood your problem, if it doesn't help you please let me know.
Avatar of Starr Duskk

ASKER

It is in a radajax panel so it doesn't repost and reset the javascript.
 
I see the problem now.

Ok, what you have to use is the responseEnd method of the radAjaxManager. When the call back is completed you will go through that handler.

That's not going to work for me as I use the radscript manager and anyway... I don't want this to run every single time it hits, I just want it when the save button is done server side and successful.
Is there someway to register some script that will call the function again after it is completed?
Something akin to this functionality, but where I could call a function that resets the value or something?

Page.ClientScript.RegisterStartupScript(t, scriptName, sb.ToString)
 
I couldn't ever find a solution to this, so I just did a page refresh on the SAVE button so it would reload the page and reset the isdirty flag. All the other buttons still use the ajax.
Thanks for trying to help.