You need to sign in to do that
Don't have an account?
forceapp
Save on edit in own VF page.
My problem is that,
I have own VF page, using controller.The obj used is department it has fieds like name,email & phone. Now in a page block table i have
Action Name Email Phone
Edit xxxx x@mail.com 0000
when i click edit , it should convert to (save) and name,email & phone field values should convert to text boxes. After that when i click save it should be saved..
sorry for that.
change your controller to this and let us know the results.
All Answers
Please share your code
This is my code:
<apex:page controller="Employ" sidebar="false" showHeader="true" id="pg">
<apex:pageBlock title="Employee List" id="pb2">
<apex:form id="f1" >
<apex:pageBlockTable value="{!emplst}" var="emp" id="pbt">
<apex:column headerValue="Action">
<apex:commandLink action="{!mylst}" />
<apex:outputLink style="font-weight:bold" >Edit</apex:outputLink></apex:column>
<apex:column value="{!emp.name}"/>
<apex:column value="{!emp.Email__c}"/>
<apex:column value="{!emp.Phone__c}"/>
<apex:column value="{!emp.id}"/>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
</apex:page>
public with sharing class Employ{
public String sname{get;set;}
public String semail{get;set;}
public String sphone{get;set;}
public PageReference mylst()
{
List<Employ__c> mylst;
mylst=[select name,Email__c,Phone__c from Employ__c ];
sname=mylst.get(0).Name;
semail=mylst.get(0).Email__c;
sphone=mylst.get(0).Phone__c;
return null;
}
List<Employ__c> emplst;
public List<Employ__c> getemplst()
{
emplst=[select name,id,Email__c,Phone__c from Employ__c];
return emplst;
}
}
Do u have any solution for this..................
change your page to following code:
and controller:
let me know if any issue happens
First thanks for ur reply and
The error is
Error: Unknown property 'String.name'
and it continued for email, phone...
another thing is, the field valus name, email & phone should be chenged to text boxes..... when we enter new record in the boxes, it should be changed.
Thanks & Regards,
forceapp.
sorry for that.
change your controller to this and let us know the results.
Thank you, I got it..............
Thank you the functionality is working.
And one thing in the test class the code coverage is 100% but a exception
System.NullpointerException:Attempt to dereference a null object
How can it be solved...
Another is,as in the senario the entire page is refreshing. Is there possibility to refresh single record when it is edited and saved.....
Thanks & Regards,
forceapp
post your testClass code
This is my Test class