• Gomsuey
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies

I am trying to use the result of the user selecting a radio button to rerender a pageblocksection ( before they would press the save button )

 

I've attempted this by using Javascript and the 'onclick' parameter to the apex:selectOption

 

 

<script>
var displayDetails = true;
	
function setDisplayDetails(toDisplay) {
	displayDetails = toDisplay;
}
	
function getDisplayDetails() {
        return displayDetails;
}
</script>
	
<apex:form >
	<apex:pageBlock mode="edit">

		<apex:pageBlockSection title="Section 1" columns="1">
			<apex:pageBlockSectionItem >
				<apex:outputText value="Select yes or no?" />
				<apex:selectRadio value="{!Custom_Object__c.Custom_object_field__c}">
					<apex:selectOption itemValue="true" itemLabel="Yes" onclick="setDisplayDetails(false);" />
					<apex:selectOption itemValue="false" itemLabel="No" onclick="setDisplayDetails(true);" />
					<apex:actionSupport event="onchange" rerender="Details" />
				</apex:selectRadio>
			</apex:pageBlockSectionItem>
		</apex:pageBlockSection>

		<apex:pageBlockSection title="Details" columns="1" id="Details"
			rendered="getDisplayDetails();">

 I've discovered that the rendered="getDisplaydetails();" section isn't working as it is expecting a value that equates to a boolean and doesn't appear the call a Javascript function.

 

I'm beginning to think that I will need a custom controller to return a value to the pageBlockSection.

Then the question becomes, how do I set the value of the selected radio button into the custom controller?

Can I do this from the Javascript function setDisplayDetails?

 

Can any one tell me how can i add all user in a multi select  picklist.

 Can any one help me how can i do it.

 

I hope any one help me.

 

 

I am trying to use the result of the user selecting a radio button to rerender a pageblocksection ( before they would press the save button )

 

I've attempted this by using Javascript and the 'onclick' parameter to the apex:selectOption

 

 

<script>
var displayDetails = true;
	
function setDisplayDetails(toDisplay) {
	displayDetails = toDisplay;
}
	
function getDisplayDetails() {
        return displayDetails;
}
</script>
	
<apex:form >
	<apex:pageBlock mode="edit">

		<apex:pageBlockSection title="Section 1" columns="1">
			<apex:pageBlockSectionItem >
				<apex:outputText value="Select yes or no?" />
				<apex:selectRadio value="{!Custom_Object__c.Custom_object_field__c}">
					<apex:selectOption itemValue="true" itemLabel="Yes" onclick="setDisplayDetails(false);" />
					<apex:selectOption itemValue="false" itemLabel="No" onclick="setDisplayDetails(true);" />
					<apex:actionSupport event="onchange" rerender="Details" />
				</apex:selectRadio>
			</apex:pageBlockSectionItem>
		</apex:pageBlockSection>

		<apex:pageBlockSection title="Details" columns="1" id="Details"
			rendered="getDisplayDetails();">

 I've discovered that the rendered="getDisplaydetails();" section isn't working as it is expecting a value that equates to a boolean and doesn't appear the call a Javascript function.

 

I'm beginning to think that I will need a custom controller to return a value to the pageBlockSection.

Then the question becomes, how do I set the value of the selected radio button into the custom controller?

Can I do this from the Javascript function setDisplayDetails?