Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Problem with saving pagereference method pls can a...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Problem with saving pagerefere nce method pls can any one help me pls
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 08:26 PM - edited 11-14-2012 08:30 PM
Hello every one i want to implement a fucntionality like shoping cart.In this there is a form to fill details,after filling we need to press add ,when we press add the details in form should added to pageblock table one by one but the records are not commited until we press save button.
In this i have completed adding to pageblock table but facing the problem when saving records can any one help me pls
i am attching my code too
visual force code :
<apex:page standardController="Test_Case_Log__c" extensions="TestClass" >
<apex:form id="form">
<apex:pageMessages />
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save1}" rerender="pbtable"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information" id="psi" >
<apex:inputField value="{!testlog.Developer__c}" />
<apex:inputfield value="{!testlog.name}" />
<apex:inputField value="{!testlog.Priority__c}" />
<apex:inputField value="{!testlog.Test_Cases__c}" />
<apex:inputField value="{!testlog.Tester__c}" />
<apex:inputField value="{!testlog.Test_Scenario__c}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Description" id="psd">
<apex:inputField value="{!testlog.Expected_Result__c}" />
<apex:inputField value="{!testlog.Test_Case_Notes__c}" />
</apex:pageBlockSection>
<apex:pageBlockTable value="{!testlog1}" var="a" id="pbtable" >
<apex:column value="{!a.Priority__c}" headerValue="Priority"/>
<apex:column value="{!a.Developer__c}" headerValue="Developer"/>
<apex:column value="{!a.Test_Cases__c}" headerValue="Expected_Result"/>
<apex:column value="{!a.Test_Scenario__c}" headerValue="testscenario"/>
</apex:pageBlockTable>
<apex:commandButton action="{!add}" value="add" rerender="form"/>
</apex:pageBlock>
</apex:form>
</apex:page>
public with sharing class TestClass {
public TestClass(ApexPages.StandardController controller) {
testlog = (Test_Case_Log__c)Controller.getRecord();
}
public list<Test_Case_Log__c> tdt = new list<Test_Case_Log__c>();
public list<Test_Case_Log__c> gettestlog1(){
return tdt;
}
public Test_Case_Log__c testlog{set;get;}
public void add(){
tdt.add(testlog);
testlog =new Test_Case_Log__c();
}
public pagereference save1(){
insert tdt;
PageReference pageRef = new PageReference('/apex/testpage');
return pageRef;
}
}Thank you
Solved! Go to Solution.
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 08:27 PM
whats the problem that you are facing?
My Blog
Kiran
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 08:36 PM
when i am saving all the records on table it is throwing validation error,form is having one master detail relation ship fild the save method is trying to save the empty form ,so it is giving validation error
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 09:06 PM
r u giving the master detail value in the UI?
My Blog
Kiran
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 09:21 PM
yes i have solved the issue ,i have added
<apex:commandButton value="save" action="{!save1}" immediate="true"/>
so it will skip the validation.
Thanks for your helping behaviour,i have one more issue ,
i need to delete the individual record on the table can you help me in the above form.
i.e i need to have individual delete button for every row n when we press the button it need to delete the particular row.
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 10:54 PM
you can acheive that some thing like below
<apex:pageBlockTable value="{!testlog1}" var="a" id="pbtable" >
<apex:column value="{!a.Priority__c}" headerValue="Priority"/>
<apex:column value="{!a.Developer__c}" headerValue="Developer"/>
<apex:column value="{!a.Test_Cases__c}" headerValue="Expected_Result"/>
<apex:column value="{!a.Test_Scenario__c}" headerValue="testscenario"/>
<apex:commandButton value="Del"action="{!del}"rerender="table" >
<apex:param name="delname" value="{!a.Test_Scenario__c}" />
</apex:commandLink>
</apex:pageBlockTable>
/* your Delete functionality*/
public PageReference del() {
string delnumber =
ApexPages.CurrentPage().getParameters().get('delnu
system.assert( delnumber != null );
integer gone = -1;
integer i = 0;
for ( i=0; i< casenumber ="="" gone =" i;">= 0) {
todeletelist.add(listofobjectitems.remove(gone) );
}
return null;
}
My Blog
Kiran
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 02:09 AM
Thank you kiran i will go through and inform you if i get any help.
Thanks&Regards,
Veerendranath
Re: Problem with saving method pls can any one help me pls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-18-2012 01:46 AM
Hi kiran,
I have implemented the Delete functionality .But i have taken Wrapperclass I need your help in writing Test class for that.
I tried to write but it covers only 70%.Can you help me in this plss.
I am posting the Class and Can you help me in it.
public with sharing class TestClass {
public boolean isRender = false;
public integer deleteSpecifier=0;
public Test_Case_Log__c testLog{get;set;}
public List<TestCaseLogsClass> gettestlog12(){
return TestCaseLogsClassList;
}
public List<Test_Case_Log__c> testCaseLogList = new List<Test_Case_Log__c>();
public TestClass(ApexPages.StandardController controller) {
testLog = (Test_Case_Log__c)Controller.getRecord();
}
public boolean getIsRender(){
if(TestCaseLogsClassList.size()>0){
isRender = true;
}
else{
isRender = false;
}
return isRender;
}
public void add(){
deleteSpecifier = deleteSpecifier+1;
TestCaseLogsClassList.add(new TestCaseLogsClass(testLog,deleteSpecifier));
testLog = new Test_Case_Log__c();
}
public pagereference save1(){
for(Integer i=0;i<TestCaseLogsClassList.size();i++){
testCaseLogList.add(TestCaseLogsClassList[i].objTe stCaseLog);
}
if(testCaseLogList.size()>0){
insert testCaseLogList;
PageReference pageRef = new PageReference('/a02/o');
return pageRef;
}
return null;
}
public void deleteTestCaseLog(){
Integer delcsDetId = Integer.valueOf(System.currentPageReference().getP arameters().get('delcsDetId'));
for(Integer deleteSpecifier=0;deleteSpecifier<TestCaseLogsClas sList.size();deleteSpecifier++){
if(delcsDetId == TestCaseLogsClassList[deleteSpecifier].deleteID){
TestCaseLogsClassList.remove(deleteSpecifier);
break;
}
}
}
public List<TestCaseLogsClass> TestCaseLogsClassList = new List<TestCaseLogsClass>();
public class TestCaseLogsClass {
public Test_Case_Log__c objTestCaseLog{get;set;}
public Integer deleteID{get;set;}
public TestCaseLogsClass(Test_Case_Log__c objTestCaseLog1,Integer deleteID1){
deleteID = deleteID1;
objTestCaseLog = objTestCaseLog1;
}
}
}Thanks In Advance
Regards,
Veeru

