You need to sign in to do that
Don't have an account?
Anshii
Displaying the field values from Visualforce
Hi All,my scenario is to display the feild values(in InputField) from vf on pageload also populate some fields in outputText ,and when I click on Button the values which are populated should shown as pdf format.
I have tried so far using lookup ,Below code which i have wrote.But without using lookup onload of the vf page the values should populate .whatever the populated values should shown as pdf format when i click on button..please helpme out .
Thanks in Advance.
class:
public class AccountcontrollerExample {
public contact c{set;get;}
public AccountcontrollerExample(Apexpages.StandardController stdcontroller){
c=(contact)stdcontroller.getRecord();
}
public void show(){
Account acc=[select id,name,phone,Description from Account where id=:c.accountid];
c.Description=acc.Description;
c.Assistantphone=acc.Phone;
}
}
vf:
<apex:page standardcontroller="contact" extensions="AccountcontrollerExample">
<apex:form >
<apex:actionFunction name="Autopopulate" action="{!show}"/>
<apex:pageBlock title="myInfo" tabStyle="Account">
<apex:pageBlockSection title="AccCon Info" collapsible="false">
<apex:inputField value="{!c.AccountId}" onchange="Autopopulate()"/>
<apex:outputText value="{!c.Description}"/>
<apex:outputText value="{!c.Assistantphone}"/>
</apex:pageBlockSection>
<!--- <apex:pageBlocksection>
<apex:commandLink value="pdf" action="/apex/AccountcontrollerExample?isPdf=true"/>
</apex:pageBlocksection>-->
</apex:pageBlock>
</apex:form>
</apex:page>
I have tried so far using lookup ,Below code which i have wrote.But without using lookup onload of the vf page the values should populate .whatever the populated values should shown as pdf format when i click on button..please helpme out .
Thanks in Advance.
class:
public class AccountcontrollerExample {
public contact c{set;get;}
public AccountcontrollerExample(Apexpages.StandardController stdcontroller){
c=(contact)stdcontroller.getRecord();
}
public void show(){
Account acc=[select id,name,phone,Description from Account where id=:c.accountid];
c.Description=acc.Description;
c.Assistantphone=acc.Phone;
}
}
vf:
<apex:page standardcontroller="contact" extensions="AccountcontrollerExample">
<apex:form >
<apex:actionFunction name="Autopopulate" action="{!show}"/>
<apex:pageBlock title="myInfo" tabStyle="Account">
<apex:pageBlockSection title="AccCon Info" collapsible="false">
<apex:inputField value="{!c.AccountId}" onchange="Autopopulate()"/>
<apex:outputText value="{!c.Description}"/>
<apex:outputText value="{!c.Assistantphone}"/>
</apex:pageBlockSection>
<!--- <apex:pageBlocksection>
<apex:commandLink value="pdf" action="/apex/AccountcontrollerExample?isPdf=true"/>
</apex:pageBlocksection>-->
</apex:pageBlock>
</apex:form>
</apex:page>
Friendly Yew
Good one, I had no idea about this trick. Make sense if it works pretty well. Thanks! https://www.rapidfs.us/