You need to sign in to do that
Don't have an account?
Btuitasi1
Custom Controller for form
I am using an apex form to insert data into a custom object. My code is:
Custom Controller:
<apex:form> <apex:pageBlock mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Submit" styleClass="btn blu btn-data"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="1"> <apex:inputField value="{!Comments__c.Name}"/> <apex:inputField value="{!Comments__c.Subject__c}"/> <apex:inputField value="{!Comments__c.Comments__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form>I know this is easily done with a standard controller, but I have a repeater in use already that uses a custom controller. How would I add this capability to my custom controller?
Custom Controller:
public with sharing class challengeDiscuss { public List<Challenge__c> getRecentChallenge1() { return [SELECT Id, Name, CreatedDate, Description__c FROM Challenge__c order by createdDate desc Limit 1]; } public List<Challenge_Comment__c> getRecentComments10() { return [SELECT Id, Name, CreatedDate, Comment__c FROM Challenge_Comment__c order by createdDate desc, CreatedDate desc Limit 10]; } }Thanks!!
Sample Apex Code
Sample VF Page
Please let me know if this helps.
Thanks,
Kaustav
All Answers
Sample Apex Code
Sample VF Page
Please let me know if this helps.
Thanks,
Kaustav
If you want the button to appear in any one position then you need to do something like this
<apex:pageBlockButtons location="top">
<apex:commandButton action="{!saveComments}" value="Submit" styleClass="btn blu btn-data" reRender="theForm"/>
</apex:pageBlockButtons>
Please let me know if this helps.
Thanks,
Kaustav