Drop down list clientside validation before postback
Posted on 2006-05-31
I have a drop down list and when the value changes, a postback occurs.
I want to show a popup warning when the value is changed to warn the user about making the change, giving the user the ability to cancel. I am using the Javascrpt confirm function to warn the user.
The pop up appears, but the postback is not happening. If I add change this to work from a buttons onClick event, it works okay.
Code behind - In the page load:
ddlPersonTypes.Attributes.Add("onChange", "return changePersonType();")
// Ask user to confirm.
var retValue = confirm("Changing the user type may result in loss of existing data.\n\nContinue?");
// Check users response.
if (retValue == true)