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

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.
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 <br></br> <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> <apex:inputCheckbox label="No" id="N" onchange="return confirmDisbaled(this.checked, '{!$Component.Y}','{!$Component.cntry}');"/> </apex:pageblocksection> If yes, <br></br> <apex:pageblocksection > <apex:outputPanel id="thePanel"> <apex:pageBlockSectionItem rendered="{!displayInputputText}"> <apex:outputLabel value="Input Text" /> <apex:inputText value="{!input}"/> </apex:pageBlockSectionItem> </apex:outputPanel> </apex:pageblocksection> public with sharing class VFTestController { public VFTestController() { } public Review__c r{get; set;} public Review__c setr(Review__c view){ this.r=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(); re.Would_you_like_to_receive_a_complimentar__c=r.Would_you_like_to_receive_a_complimentar__c; insert re; Pagereference pg = new Pagereference('/' + re.id); pg.setredirect(true); return pg; } public Boolean displayInputputText{get;set;} public Boolean chkBx{get;set;} public String input{get;set;} public PageReference click(){ if(chkBx){ displayInputputText = true; } else { displayInputputText = false; } return null; }
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.
Change:
<apex:inputText value="{!input}"/>
To:
<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.