You need to sign in to do that
Don't have an account?

Popup not Closing
Any idea why the popup is not closing in the below code. This is code for my Popuup Window from "New Vehicle" related
list of Case. It opens fine, but I want it to close if I hit the cancel button or Save -- after saving the information.
Serial_Number__c is Required
When I hit "Close" It says pls fill in the Required Fields.
Also When I hit "Save" it does not close.
Any idea Why ??
<apex:page standardController="Case_Vehicle__c" sidebar="false" >
<script language="JavaScript" type="text/javascript">
function closeAndRefresh()
{
window.close();
window.opener.location.reload();
}
</script>
<apex:form >
<apex:pageBlock title="Case Vehicle" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" oncomplete="closeAndRefresh()"/>
<apex:commandButton value="cancel" onclick="closeAndRefresh()" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Vehicle Information" columns="2">
<apex:inputField value="{!Case_Vehicle__c.Serial_Number__c}"/>
<apex:inputField value="{!Case_Vehicle__c.VIN__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Case__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Color__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Country__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Driver_Name__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Engine_Hours__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Fuel_Type__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Harness_Type__c}"/>
<apex:inputField value="{!Case_Vehicle__c.License_State__c}"/>
<apex:inputField value="{!Case_Vehicle__c.License_Plate__c}"/>
<apex:inputField value="{!Case_Vehicle__c.YMM__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Odometer__c}"/>
<apex:inputField value="{!Case_Vehicle__c.Vehicle_Label__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
