简体   繁体   English

想要基于在vf页面中的复选框上单击来显示文本

[英]want to display the text based on click on the checkbox in vf page

want to display text in filed based onclick of checkbox in VF page.but the same checkbox is calling one method. 想要基于VF页面中复选框的单击在字段中显示文本。但是同一复选框正在调用一种方法。 code is bellow....please write controller. 代码如下所示。...请写控制器。 need urget help.. 需要紧急帮助。

<apex:outputPanel id="jobPanel">


Try the code below 试试下面的代码

Apex Class: 顶点类:

public class Test 
{
   public Boolean isChecked { get; set; }       
   public String myText{get;set;}
   public void controllerMethod()
   {
       myText = 'Your Text field rendered';
       //assign text field values
   }
}

Visualforce Page: Visualforce页面:

<apex:page controller="Test" >
  <apex:form >  
   <apex:pageBlock id="jobBlock">
      <apex:inputCheckbox id="inche" value="{!isChecked}" >
          <apex:actionsupport event="onclick" action="{!controllerMethod}" rerender="jobPanel" />
      </apex:inputCheckbox>

      <apex:outputPanel id="jobPanel">
          <apex:pageBlockSection rendered="{!isChecked}">
              <apex:pageblockSectionItem >
                   <apex:inputText value="{!myText}"/>
              </apex:pageblockSectionItem>                           
          </apex:pageBlockSection>
      </apex:outputPanel>
   </apex:pageBlock>
 </apex:form>
</apex:page>

Hope it helps you 希望对您有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM