You need to sign in to do that
Don't have an account?
Chittineni Sandeep
How to save records from vf pages to object when I click on the save button
My Code For VF page:
My Apex class:
Thanks in Advance
<apex:page controller="SurveyType" tabStyle="Dynamic_Checkbox__c"> <apex:form > <script> function cbChange(obj) { var cbs = document.getElementsByClassName("cb"); for (var i = 0; i < cbs.length; i++) { cbs[i].checked = false; } obj.checked = true; } </script> <apex:pageBlock > <apex:pageblockSection > <apex:selectOption> <apex:inputField value="{!dc.Good__c}" onchange="cbChange(this)" styleClass="cb" rendered="true" />Good<br/> <apex:inputField value="{!dc.Bad__c}" onchange="cbChange(this)" styleClass="cb" rendered="true" />Bad<br/> </apex:selectOption> </apex:pageblockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
My Apex class:
public class SurveyType { public Dynamic_Checkbox__c dc{get;set;} public SurveyType (){ dc = new Dynamic_Checkbox__c(); } public void save(){ dc = new Dynamic_Checkbox__c(); insert dc; } }
Thanks in Advance
try below class before insert new record on Dynamic_Checkbox__c object make sure all mandatory / required fields you add in your code like (Name) and any others
thanks
let me inform if it helps you
All Answers
try below class before insert new record on Dynamic_Checkbox__c object make sure all mandatory / required fields you add in your code like (Name) and any others
thanks
let me inform if it helps you