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
tangotango 

Command button to redirect


I seem to have the syntax off a bit here. I just want a function to redirect (as a short cut) to a target template folder.

Is there an easier way to just redirect the page from a VF page?

Code:
<script language="JavaScript">
function market_templates() {
window.parent.location.href="/00X?setupid=EmailTemplates&fcf=00l4000000101yK";
}
</script>


<apex:commandButton action="" value="Review Templates" title="Link to Email Templates" onclick="market_templates();"  / >


 


David VPDavid VP
Since you don't seem to be calling any controller methods, you might as well use standard HTML :

Code:
<input type="button" value="Review Templates" class="btn" onclick="market_templates()"/>

 

-David
jwetzlerjwetzler
Instead of using javascript you should bind your commandButton to an action method in your controller (please review the documentation).

Or since you're not really interested in performing some type of action other than a redirect, I would personally just use outputLink and then give it some appropriate styling to get it to look like a button, if that's what you want.