When the user clicks the command button, the action does not fire, but the redirect to the new url does. I want the users record to save (validation rules, etc to get called first), then if it saves ok, let them proceed to the new url.
<apex:page standardController="Opportunity" standardStylesheets="true" extensions="OpportunityController" >
<apex:form >
<center>
<apex:commandButton action="{!save}" onComplete="openWindow()" value="Change Record Type" />
<script>
function openWindow(){
window.parent.parent.window.location = ("{!redirect}");
}
</script>
</center>
</apex:form>
</apex:page>