+ Start a Discussion

Getting custom checkbox value ( not related to object) in apex

Hello All ,

I have designed a sample action function method to a call controller from JS and its working  fine.But  I need to do an enhancement like if checkbox is unselected the output text should not be rendered ( currenlty , once if the checkbox is selected , it remains forever) . Please help me ,below is the code.
P.S : Check box is not part of object , its just custom checkbox which is created in VF page

Public class Actionfunction {
Public string MyString_From_Methode{get;set;}
    public Actionfunction(ApexPages.StandardController controller) {


    public string ActionFunMethode(){
     MyString_From_Method = 'Method called from js using Action function';

     return null;

Apex :

<apex:page standardcontroller="Account" extensions="Actionfunction" tabStyle="Account">
    <apex:form >
       <apex:actionFunction name="actionFunName" action="{!ActionFunMethod}" reRender="outputtxtId"/>
       <apex:pageBlock > 
            <apex:outputLabel for="inptCheckBox" value="Check this box to call Controller method from js using ActionFunction" style="color:green;"></apex:outputLabel> 
            <apex:inputcheckbox onclick="javaScrpt()" id="inptCheckBox" />
      <apex:outputText value="{!MyString_From_Methode}" id="outputtxtId" ></apex:outputText> 
      function javaScrpt(){
Amit Chaudhary 8Amit Chaudhary 8
Please try wrapper classes for same.

Please let us know if this will help you
ok Thanks , Let me try using wrapper class but is there any other way apart from wrapper class .