You need to sign in to do that
Don't have an account?

Invoking a custom class with a button
Hi,
I have a custom apex class (which works properly when executed anonymously through the IDE) and would like to be able to invoke the class with the click of a button on a visual force page. I have a feeling it's really simply, but i just can't seem to figure it out.
Here's what I have so far:
<apex:page > <apex:enhancedList type="SPC_Settings__c" height="358" rowsPerPage="10" id="SPCSettings" /> <apex:form > <br /> <apex:commandButton style="float:right;" action="sforce.apex.execute('SPCSettingsUpdate',{},{}" value="Update" id="btnUpdate" /> </apex:form> </apex:page>
Any help would be greatly appreciated!
my suggestion, but you will still need to make mods to get the controller to initialize and the action may need a parameter
<apex:page controller="SPCSettingsUpdate" > <apex:enhancedList type="SPC_Settings__c" height="358" rowsPerPage="10" id="SPCSettings" /> <apex:form > <br /> <apex:commandButton style="float:right;" action="{!Update}" id="btnUpdate" /> </apex:form> </apex:page>
All Answers
my suggestion, but you will still need to make mods to get the controller to initialize and the action may need a parameter
<apex:page controller="SPCSettingsUpdate" > <apex:enhancedList type="SPC_Settings__c" height="358" rowsPerPage="10" id="SPCSettings" /> <apex:form > <br /> <apex:commandButton style="float:right;" action="{!Update}" id="btnUpdate" /> </apex:form> </apex:page>
So in the above case is update just the name of a function within the class?
Got it working, thanks Ron!