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
Marketing Marketing 27Marketing Marketing 27 

Rerender on save button causing a "Refused to Connect" Error. Help!

This is the 2nd post I've made about this issue with the ReRender Attribute.

My page is using the opportunity standard controller and has an extension with the below Save method I am calling from my commandButton
 
public PageReference Save(){

        try{
            insert TD2nd;
            TD1st.X504_Related_Opportunity__c = TD2nd.Id;
            update TD1st;
            return new Pagereference('https://company--sandboxname.sandbox.lightning.force.com/lightning/r/Opportunity/' + TD2nd.Id +'/view');           
        }
        catch(DmlException d){
            Apexpages.addMessages(d);
            return NULL;
        }
    }

my save button looks like the below:
<apex:pagemessages id="msgs2"/>
             
             <div align="center">
                 <apex:commandButton action="{!Cancel}" value="Cancel"/>
                 <apex:commandButton action="{!Save}" value="Save" reRender="msgs, msgs2"/>
             </div>
I put in the ReRender attribute so that if the user gets validation rules, they won't lost their work. However, when there are no validation rules and the save method executes, I get a grey page with a "Refused to Connect" error message. 

When I exit out of the page, I see that the new opportunity was inserted and everything worked fine, however, ever since I added the Rerender attribute, my save method can no longer navigate to the new opportunity without getting this error. 

What am I doing wrong??
 
Marketing Marketing 27Marketing Marketing 27
So I've realized by looking at the chrome dev tools that this error is being caused by having developer mode enabled. When I turn off developer mode for my user, the error, goes away. Has anyone else ever experienced this and how do I fix it?
Leo WatkinsLeo Watkins

Connection refused means that the port you are trying to connect to is not actually open. So either you are connecting to the wrong IP address, or to the wrong port, or the server is listening on the wrong port, or is not actually running.

 

https://www.mcdvoice.guru/