You need to sign in to do that
Don't have an account?
SV M
Adding Button to Visualforce Page
Hi, I would like add buttons at each row of visuallforce page and when I click the button it should give an alert which should get the Name of that Account since here I am using my standardCOntroller as Account object.
I've below code
<apex:page standardController="Account" recordSetVar="Accounts" sidebar="False">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Details">
<apex:pageBlockTable value="{!Accounts}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.Type}"/>
<apex:column value="{!a.Website}"/>
<apex:column headerValue="Details">
<apex:commandButton value="Details"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
It gave me buttons at each row.
Please tell me how to create custom action for the button to get the Name of the account as a alert..
I've below code
<apex:page standardController="Account" recordSetVar="Accounts" sidebar="False">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Details">
<apex:pageBlockTable value="{!Accounts}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.Type}"/>
<apex:column value="{!a.Website}"/>
<apex:column headerValue="Details">
<apex:commandButton value="Details"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
It gave me buttons at each row.
Please tell me how to create custom action for the button to get the Name of the account as a alert..
You can use OnClick event of the command button for this purpose. You'll have to call a javascript function on onClick event. Please refer the following code. Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.
Thanks and Regards