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
QuickDEVQuickDEV 

Accessing <apex:outputPanel> "id" in JavaScript function

Hi,

 

I have <apex:outputPanel id="hide" layout="block">.

Html radio buttons with onclick events. Javascript function to handle the above events. 

 

My question is: I am trying to hide the the content present in  <apex:outputPanel> [ which results in <div>]

I am not sure how to access the id of the outputpanel and hide/show when the radio buttons are clicked.

I tried something like :  $Component.blockID.tableID

. [Link] , but did not succeed.

 

Any help or direction on this highly appreciated.

 

Thanks 

 

 

thangasan@yahoothangasan@yahoo
Hai

Use this sample ,Here i am using action support ,you can use action function also.

// Controller
public class sampleSel {
String changeValue = null;

public List getItems() {
List options = new List();
options.add(new SelectOption('View','View'));
options.add(new SelectOption('Hide','Hide'));
return options;
}

public String getChangeValue() {
return changeValue;
}

public void setChangeValue(String changeValue) {
this.changeValue = changeValue;
}

}

//Page











You have selected view




You have selected Hide






Regards
Thanga
thangasan@yahoothangasan@yahoo

Here Page

 

<apex:page controller="sampleSel">

<apex:form >
<apex:selectRadio value="{!changeValue}" >
<apex:selectOptions value="{!items}" />
<apex:actionSupport event="onclick" rerender="out" />
</apex:selectRadio>

</apex:form>
<apex:outputPanel id="out" >
<apex:outputPanel rendered="{!changeValue='View'}">
<p>You have selected view</p>
</apex:outputPanel>
<apex:outputPanel rendered="{!changeValue='Hide'}">
<p>You have selected Hide</p>
</apex:outputPanel>
</apex:outputPanel>
</apex:page>
UmapenUmapen

I am trying the sample code

 

I get error at the following code:

Error: Compile Error: expecting a left angle bracket, found 'getItems' at line 3 column 16

public List getItems() { List options = new List();

 

 

Can you please share working controller?

sfdcfoxsfdcfox
In the above example, List should be List<SelectOption>. Lists always need to have a data type associated to them.