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
skiptomylou48skiptomylou48 

Commandbutton Onclick Javascript does not work with Development Mode disabled

Hi all,

 

I have a commandbutton with the following onclick event...

onclick="window.parent.location.href='https://c.eu3.visual.force.com/apex/GRPHotProjectSummary_Edit?scontrolCaching=1&id={!Opportunity.ID}'"

....to redirect to another VF page called 'GRPHotProjectSummary_Edit'.

When I tested it everything worked fine.

However, when other users who do not have 'Development Mode' enabled in their user details nothing happen - the original page just refreshes.

 

Any suggestions how to change the onclick event?

Ideally I don't want to write a custom controller (and wouldn't know how) for just linking to another VF page.

Or do we need to enable development mode for all users in our Org?

 

many thanks! 

MTBRiderMTBRider

You do not want to embed a Salesforce URL into any code.  Although this may be why this is working for you but not others, it will definitly break your code once you move the code from a sandbox to production.  You can probably use URLFOR() instead.  See the Functions section in the appendix of the Visualforce development quide.

Avidev9Avidev9

May be you have to stop the defaul action ? Since defaul command button behaviour is submit the page.

 

<apex:commandButton onclick="window.location.href='/apex/GRPHotProjectSummary_Edit?scontrolCaching=1&id={!Opportunity.ID}';return false" value="redirect"/>

 Note : Please use relative URLs, your link may not work after migration to other environment/productin