You need to sign in to do that
Don't have an account?
sfdc98
vf and apex
Hi everyone ,i need to display list of account records with a button beside the records when i click on that button it should open a contact form and able to save the record.
tried so far..
class:
public class Displayrecs {
public String firstName{get;set;}
public String lastName{get;set;}
public String phone{get;set;}
//list <contact> conList;
public ApexPages.StandardSetController stdCntrlr {get; set;}
public Displayrecs(ApexPages.StandardSetController controller){
stdCntrlr = controller;
}
public pageReference Save(){
Contact con = new Contact(firstname=firstname, lastname=lastname, phone=phone);
//conList.add(con);
insert con;
return null;
}
}
vf:
<apex:page standardController="Account" recordSetVar="accounts" extensions="Displayrecs" >
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value="{!accounts}" var="a" id="list">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.rating}"/>
<apex:column>
<apex:commandButton action="{!save}" value="save"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
able to view like above screenshot.
Thanks in Advance
tried so far..
class:
public class Displayrecs {
public String firstName{get;set;}
public String lastName{get;set;}
public String phone{get;set;}
//list <contact> conList;
public ApexPages.StandardSetController stdCntrlr {get; set;}
public Displayrecs(ApexPages.StandardSetController controller){
stdCntrlr = controller;
}
public pageReference Save(){
Contact con = new Contact(firstname=firstname, lastname=lastname, phone=phone);
//conList.add(con);
insert con;
return null;
}
}
vf:
<apex:page standardController="Account" recordSetVar="accounts" extensions="Displayrecs" >
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value="{!accounts}" var="a" id="list">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.rating}"/>
<apex:column>
<apex:commandButton action="{!save}" value="save"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
able to view like above screenshot.
Thanks in Advance
Where exactly are you stuck? Thx
Thanks