You need to sign in to do that
Don't have an account?
SelectRadio to return page Message?
So I've been playing around with selectRadio but I'm having trouble getting a page message to render on the selection of an account. My original thought was to take a wrapper class and convert it into radio buttons instead of a pick list like others on this site, but I can't seem to get the right setup. I then decided I would try and use a command link and param tag and see if it was possible to just add a selectradio component. Needless to say I am completely new to this and I am using borrowed code and tutorials to teach myself this. From what I've read and understand at this point I believe I need to create an action function for the radio that changes the page message, but honestly I can't figue this out. Below is my code where the actual account names return a message, should I scrap this approach and try the wrapper class again?
<apex:page title="radiotest" controller="radiotest" sidebar="false"> <apex:form > <apex:pageBlock title="Interview Five" id="Test"> <apex:pageMessages > </apex:pageMessages> <apex:pageBlockTable value="{!Data}" var="acc"> <apex:column > <apex:commandLink value="{!acc.name}" action="{!Calling}" reRender="Test"> <apex:param name="Txt" value="{!acc.id}"/> </apex:commandLink> </apex:column> <apex:column value="{!acc.Name}"/> <apex:column value="{!acc.BillingState}"/> <apex:column value="{!acc.Phone}"/> <apex:column value="{!acc.Website}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
public class radiotest { public radiotest(){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,' Select an Account by Clicking its name.')); } List<Account> Varacc; public List<Account> getData() { string str1=Apexpages.currentpage().getParameters().get('id'); Varacc =[Select id,Name,BillingState,Phone,Website from Account]; if(varacc.size()>0) { return Varacc; } return null; } public void Calling() { string str1=Apexpages.currentpage().getParameters().get('txt'); Account varacc=[select id,name from Account where id=:str1]; String ex=varacc.name; { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,' You have Selected the '+varacc.name+' Account')); } } }
Any help appreciated as I feel like I've exhausted all the reading material on the subjest but can't grasp it.
Try putting apex:pageMessages into an output panel and rerrender that output panel
Sorry for never responding, I never saw the update and got busy working through HTTP requests. But I have the page message working if I want to simply click the account name; however, I'm having difficulty transfering this process to a radiobutton. So I've been working with it some more but still having some issues. Most of the documentaion on the subject refers to a drop down list with select options which is not what I'm looking to do so some direction would be nice. Below is where I'm at and I understand some of this is incorrect. I've tried the selectradio option but I'm also looking into accomplishing this with html radiobutton. I have the layout correct, but I need to specify a value.
class:
page:
Alternate Page: