I have a very simple VF page that displays the Detail-tag Opportunity page. Within it, I have a Custom Button that calls the finish()
JS method. From there, I would like to submit the Opportunity within the Details-tag to the finish()
method in my Controller. Is there a way to do this?
VF Page:
<apex:page standardController="Opportunity" extensions="OpportunityViewPageController">
<script>
function finish(){
//Submit to finish() method in extension class. How?
}
</script>
<apex:detail subject="{!Opportunity}" relatedList="true" title="true" showChatter="true"
inlineEdit="true" relatedListHover="true"/>
</apex:page>
Apex Controller:
public class OpportunityViewPageController{
...
public PageReference finish(){
this.op.StageName = 'Closed Won';
upsert this.op;
return null;
}
}
ActionFunctions
cannot be used outside of<form>
tags and Id don't think I can insert theActionFunction
into the main form within the Op. I think the Remoting has a similar restriction.