+ Start a Discussion
Div403Div403 

Insert Checkbox value in custom object using vf page and controller

Hi All,

I have tried so many functioanlities but am unable to insert the checkbox value in custom object 

Kindly help me out of this

VF Page
<apex:page standardcontroller="TestExample__c" extensions="TestExample">
<apex:form>
<apex:selectCheckboxes title="Reinsurance Verification" value="{!test.TestPage__c}">
             <apex:selectOption value="{!test3}"> </apex:selectOption>
         </apex:selectCheckboxes>
<apex:outputPanel layout="block">
    <apex:commandButton value="Save and Close"   action="{!Save}"/>                           
        </apex:outputPanel>                              
</apex:form>
</apex:page>

controller

public class TestExample{
public TestExample Test{get; set;}
public SelectOption test3 {get;set;}
public TestExample{
test3 = new SelectOption('Apex', 'Apex');
test=new TestExample__c();    
}
public PageReference Save() {
TestExample__c t = new TestExample__c();
t.TestPage__c = Test.TestPage__c;
insert t;
}
}
Div403Div403
Hi Anoop,

Thanks for response.
That links gives only visualforce page. I need controller for the vf Page.
Vijay NagarathinamVijay Nagarathinam
Hi,

I think you can acheive this using standard controller not neccessary to go extensions,
 
<apex:page standardController="test__c">
<apex:form >
<apex:pageblock >
<apex:pageblocksection >
<apex:inputField value="{!test__c.name}"/>
<apex:inputField value="{!test__c.Interested_to_Relocation__c}"/>
</apex:pageblocksection>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageblock>
</apex:form>
</apex:page>

I think it will be helpful for you..