function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
amritamrit 

Javascript is not working in Google chrome,Firefox

HI,

 

Im using this javascript code in visualforce page to add functionality save and new. 'Save and new' functionality is not working in any of the browsers (Chrome,Firefox).Save functionality is working fine.How can i solve this issue

 

<apex:page standardcontroller="Promotion_Members__c" showheader="false">
<head>
<script type="text/javascript">
 var returnURL;
        
        window.onload =  function(){
        returnURL = gup("https://c.na1.visual.force.com/apex/CallResponse");
      //  alert('Record Saved ' + returnURL);
        };
        
        function gup( name ){  //this function just grabs HTTP params by name
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
        var regexS = "[\\?&]"+name+"=([^&#]*)"; 
        var regex = new RegExp( regexS ); 
        var results = regex.exec( window.location.href );
        
        if( results == null )    return ""; 
        else    return results[0];}
        
        function redirectBack(){
       // alert('Record Saved and Sending you back');
        
        window.location.href =returnURL;
        }
</script>
</head>
<apex:form >
    
    <apex:actionFunction name="saveActionFunc" action="{!Save}" oncomplete="redirectBack();return false" rerender="theBlock"/>
    <apex:pageBlock title="Promotion-Member Edit" id="theBlock">
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!Save}"/>
            <apex:commandButton value="Save and new" onClick="saveActionFunc();"/>
            <apex:commandButton value="Cancel" action="{!Cancel}"/>
        </apex:pageBlockButtons>        
    <apex:pageBlockSection title="Information">
        <apex:inputfield value="{!Promotion_Members__c.Promotions__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Contacts__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Remarks__c}"/>
    </apex:pageBlockSection> 
    <apex:pageBlockSection title="Call Response" rendered="{!($User.HO__c == TRUE || $UserRole.Name =='Director')}">
        <apex:inputfield value="{!Promotion_Members__c.Raised_Complaint__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Complaints__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Promotion_Status__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Complaint_Remarks__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.How_was_the_Promotion__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Did_you_get_any_gifts__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Will_you_recommend__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Suggestion__c}"/>
        <apex:inputfield value="{!Promotion_Members__c.Suggestion_Remarks__c}"/>
    </apex:pageBlockSection>
    <!--<apex:pageBlockSection id="id18" title="Call Response" rendered="{!($User.HO__c != TRUE && $UserRole.Name != 'Director')}">
        <apex:outputfield value="{!Promotion_Members__c.Raised_Complaint__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Complaints__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Promotion_Status__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Complaint_Remarks__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.How_was_the_Promotion__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Did_you_get_any_gifts__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Will_you_recommend__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Suggestion__c}"/>
        <apex:outputfield value="{!Promotion_Members__c.Suggestion_Remarks__c}"/>
    </apex:pageBlockSection>-->
  </apex:pageBlock>
  </apex:form>
</apex:page>