You need to sign in to do that
Don't have an account?
veeru417
How to display the selected Account name as page message .?
Hi,
I have created one pageblock table with account name some other components and ihave added a commandlink to account name .I want to display the the selected account name as pagemessage on the top of the page.
can any one help me how to do this.
<apex:page standardController="Account" recordSetVar="accounts" sidebar="false"> <apex:form > <apex:pageBlock title="MyPageBlock1" > <apex:pageBlockTable value="{!accounts}" var="s" > <apex:column headerValue="Account Name" > <apex:commandLink rerender="output"> {!s.Name} </apex:commandLink> </apex:column> <apex:column value="{!s.billingstate}" /> <apex:column value="{!s.Phone}" /> <apex:column value="{!s.website}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Thanks&Regards
Veer
Hi,
Try the below code snippet as reference:
----------Vf Page-----------------
<apex:page standardController="Account" extensions="examples36" recordSetVar="accounts" sidebar="false">
<apex:form >
<apex:pageMessages id="shwmsg"/>
<apex:pageBlock title="MyPageBlock1" >
<apex:pageBlockTable value="{!accounts}" var="s" >
<apex:column headerValue="Account Name" >
<apex:commandLink reRender="shwmsg" action="{!show}">
{!s.Name}<apex:param name="v1" value="{!s.Name}" assignTo="{!id1}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!s.billingstate}" />
<apex:column value="{!s.Phone}" />
<apex:column value="{!s.website}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
-------------- Apex Controller-----------------
public class examples36 {
public String id1{get;set;}
public examples36(ApexPages.StandardSetController controller) {
}
public void show()
{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Account Name " '+ id1 +' " Has Been Selected'));
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
If you want to do this via regular visualforce, you'll need to submit the form on selection and add a message. Its probably faster to do it in javascript.
Hi,
Try the below code snippet as reference:
----------Vf Page-----------------
<apex:page standardController="Account" extensions="examples36" recordSetVar="accounts" sidebar="false">
<apex:form >
<apex:pageMessages id="shwmsg"/>
<apex:pageBlock title="MyPageBlock1" >
<apex:pageBlockTable value="{!accounts}" var="s" >
<apex:column headerValue="Account Name" >
<apex:commandLink reRender="shwmsg" action="{!show}">
{!s.Name}<apex:param name="v1" value="{!s.Name}" assignTo="{!id1}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!s.billingstate}" />
<apex:column value="{!s.Phone}" />
<apex:column value="{!s.website}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
-------------- Apex Controller-----------------
public class examples36 {
public String id1{get;set;}
public examples36(ApexPages.StandardSetController controller) {
}
public void show()
{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Account Name " '+ id1 +' " Has Been Selected'));
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thanks dude its working