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
ShaTShaT 

How to Pass value on check box changed into Contoller

Hi,

 

 I have a checkbox on clicking the check box i what to pass the id.

 I m using param but i m unable to get id in controller

 

code-:

<apex:inputCheckbox value="{!radioCheck}">
                      <apex:actionSupport event="onclick"  action="{!UpdateTanent}" rerender="frm"/>
                       <apex:param name="managerid" value="{!p.id}" assignTo="{!getCheckedTenant}"/>                    
              </apex:inputCheckbox>

 

 

getCheckedTenant is coming null in controller.

 

I have also tried with hidden field

 

<apex:inputCheckbox value="{!radioCheck}" onclick="sendpasswd('{p.id}'})">
                      <apex:actionSupport event="onclick"  action="{!UpdateTanent}" rerender="frm"/>

     </apex:inputCheckbox>

 

<apex:inputHidden value="{!getCheckedTenant}" id="theHiddenInput"/>
  <script>
       function sendpasswd(val) {
      alert(val);
    document.getElementById("{!$Component.frm.theHiddenInput}").value =val;
  }

 

but getCheckedTenant is coming null in controller.

 

 

I Dont know where i m going wrong..!!!!

 

Thanks

Shailu

 

 

 

 

 

Navatar_DbSupNavatar_DbSup

Hi,

 

Use the action function instead of action support on the check box click .

 

Use the below code snippet as reference:

-------------- VF Page----------------

<apex:page controller="chkactonsupport" >

  <apex:form >

  <apex:inputCheckbox value="{!radioCheck}" onclick="chk()">

                     

                                      

              </apex:inputCheckbox>

  <apex:actionFunction name="callfun" oncomplete="" action="{!UpdateTanent}">  <apex:param name="managerid" value="hello" assignTo="{!getvalue1}"/>  </apex:actionFunction>

  </apex:form>

  <Script>

  function chk()

  {

      callfun();

  }

 

  </script>

</apex:page>

 

----------------- Apex Controller --------------------------

 

public class chkactonsupport

{

public string radioCheck{get;set;}

public string getvalue1{get;set;}

public void UpdateTanent()

{

    system.debug('AAAAAAAAA'+getvalue1);

}

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

lrw757lrw757

To get the parameter to pass from an action support nested in a select list, I had to set immediate to false in the action support. I don't know if it will work with an inputCheckbox though.