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
BrokenBirdBrokenBird 

Radio Buttons

I am trying to use radio button in a list, but I can't figure out how to produce what I want. This is an HTML example of what I am looking for: Survey sample

 

 

Message Edited by BrokenBird on 05-11-2009 03:06 PM
BrokenBirdBrokenBird

Well this didn't render too well, so I guess I need to explain.

I want this to work like a survey, each line is a question, and you can

select one answer per line. Depending on the selected radio button, 

the rating column would be set to a specific number.

aalbertaalbert

Can you try pasting the HTML in a code segment  by clicking on the little clipboard icon above and pasting the HTML in that section?

 

BrokenBirdBrokenBird
Also, the radio buttons could be client side only, has only the rating is stored in a field. The radio could be set to checked or not depending on the value of the rating when loading.
aalbertaalbert

I implemented something like this using a apex:dataTable,that iterates over a List of survey topics (ie line items for the survey). Additionally, I use the apex:actionSupport component to send the onclick event to the controller. This is just one way to accomplish it. 

 

 

<apex:pageBlockSection title="Please rate the following topics:" > <apex:dataTable width="100%" value="{!surveyItems}" var="s"> <apex:column width="250"> <center> <apex:facet name="header">Topic to Rate</apex:facet> <apex:outputField value="{!s.Question__c}"/> </center> </apex:column> <!-- <apex:actionFunction action="{!updateRating}" name="updateRating" > <apex:param name="firstParam" assignTo="{!tempSurveyItemQuestion}" value=""/> <apex:param name="secondParam" assignTo="{!tempSurveyItemResponse}" value=""/> </apex:actionFunction> --> <apex:column width="150"> <center> <apex:facet name="header">Very Dissatisfied</apex:facet> <input type="radio" name="{!s.Question__c}" value="{!s.id}" > <apex:actionSupport event="onclick" action="{!updateResponse}" > <apex:param name="firstParam" assignTo="{!tempSurveyItemQuestion}" value="{!s.Question__c}"/> <apex:param name="secondParam" assignTo="{!tempSurveyItemResponse}" value="Very Dissatisfied"/> </apex:actionSupport> </input> </center> </apex:column> <apex:column width="150"> <center> <apex:facet name="header">Dissatisfied</apex:facet> <input type="radio" name="{!s.Question__c}" value="{!s.id}"> <apex:actionSupport event="onclick" action="{!updateResponse}" > <apex:param name="firstParam" assignTo="{!tempSurveyItemQuestion}" value="{!s.Question__c}"/> <apex:param name="secondParam" assignTo="{!tempSurveyItemResponse}" value="Dissatisfied"/> </apex:actionSupport> </input> </center> </apex:column> <apex:column width="150" > <center> <apex:facet name="header">Neither Satisfied or Dissatisfied</apex:facet> <input type="radio" name="{!s.Question__c}" value="{!s.id}" > <apex:actionSupport event="onclick" action="{!updateResponse}" > <apex:param name="firstParam" assignTo="{!tempSurveyItemQuestion}" value="{!s.Question__c}"/> <apex:param name="secondParam" assignTo="{!tempSurveyItemResponse}" value="Neither Satisfied or Dissatisfied"/> </apex:actionSupport> </input> </center> </apex:column> <apex:column width="150"> <center> <apex:facet name="header">Satisfied</apex:facet> <input type="radio" name="{!s.Question__c}" value="{!s.id}" > <apex:actionSupport event="onclick" action="{!updateResponse}" > <apex:param name="firstParam" assignTo="{!tempSurveyItemQuestion}" value="{!s.Question__c}"/> <apex:param name="secondParam" assignTo="{!tempSurveyItemResponse}" value="Satisfied"/> </apex:actionSupport> </input> </center> </apex:column> <apex:column width="150"> <center> <apex:facet name="header">Very Satisfied</apex:facet> <input type="radio" name="{!s.Question__c}" value="{!s.id}" > <apex:actionSupport event="onclick" action="{!updateResponse}" > <apex:param name="firstParam" assignTo="{!tempSurveyItemQuestion}" value="{!s.Question__c}"/> <apex:param name="secondParam" assignTo="{!tempSurveyItemResponse}" value="Very Satisfied"/> </apex:actionSupport> </input> </center> </apex:column> </apex:dataTable> </apex:pageBlockSection>

 

 

 

NaishadhNaishadh

Hi,

 

Can you please post your complete working code? I am trying to developed

opportunity merge component using your solution but  not yet succeed.

 

Thanks

Message Edited by Naishadh on 05-12-2009 04:22 AM
BrokenBirdBrokenBird

Thanks for the code aalbert.

Message Edited by BrokenBird on 05-13-2009 02:15 PM