function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jack A 2Jack A 2 

Little help in writing a controller.

I have a custom object Review__c and it has MD relationship to contact.
I have checkbox and text field in Review__c object.

Now from VF page I am trying to insert data into custom object fields.

I am having difficulty writing controller class.
VF Page:

Have there been any significant changes
<apex:pageblocksection >

            <apex:inputcheckbox value="{!chkBx}" label="Yes"  id="Y" onchange="return confirmDisbaled(this.checked, '{!$Component.N}','{!$Component.cntry}');"> 
                <apex:actionSupport event="onchange" rerender="thePanel" action="{!click}"/>    
           <apex:inputCheckbox label="No" id="N" onchange="return confirmDisbaled(this.checked, '{!$Component.Y}','{!$Component.cntry}');"/>  

If yes, 
<apex:pageblocksection >
<apex:outputPanel id="thePanel">    
              <apex:pageBlockSectionItem rendered="{!displayInputputText}">
                    <apex:outputLabel value="Input Text" />
                    <apex:inputText value="{!input}"/>  

public with sharing class VFTestController { 
     public VFTestController() {

     public Review__c r{get; set;}
     public Review__c setr(Review__c view){
     return r;
     public VFTestController(ApexPages.StandardController controller) {
     public Id viewid{get;set;}
     Id id = apexpages.currentpage().getparameters().get('id');

     public pagereference save(){
     Review__c re  = new Review__c();

     insert re;
     Pagereference pg = new Pagereference('/' +;
     return pg;

    public Boolean displayInputputText{get;set;}
    public Boolean chkBx{get;set;}
    public String input{get;set;}       
    public PageReference click(){    
             displayInputputText = true;
         else {
             displayInputputText = false;
         return null;   

Hi Jack,

You have a variable in the controller for the review record, however you are not referencing this variable anywhere in the visualforce page.

If your goal is to eventually insert a review record given user input you can you can reference that review variable directly from the input field on the visualforce page. 

<apex:inputText value="{!input}"/> 
<apex:inputCheckbox value="{!r.Would_you_like_to_receive_a_complimentar__c}"/>

Then have a command button call the save method for when the user is done filling out the input.