• Shobhit T
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 15
    Replies
Hi,

I have a VF page in which I am saving and adding the values through two buttons. 
Buttons are working fine. when i click the add button, a new row is added and when i click on save button,data is saved in Read only mode. But when i refresh the page , the values are saved in edit mode and not in read only mode. So, my questions is how to Save the Data in Read only mode on Page refresh. 
My Vf Page code :- 
<apex:page standardcontroller="Assigned_tasks__c" extensions="TestTaskController1">
<apex:form >
<apex:pageBlock > 
<div id="hide">
 <apex:pageBlockSection title="Input Page" id="pgsec" rendered="{!saved}">
<apex:pageBlockTable value="{!reportlist}" var="acc"> 
<apex:column headerValue="Report Name"> 
<apex:inputField value="{!acc.Report_Name__c}" /> 

 <br /> </apex:column> 
  <apex:column headerValue="Comments">
 <apex:inputField value="{!acc.Comments__c}"/> 
 </apex:column> 
 <br/>
 </apex:pageBlockTable>
  </apex:pageBlockSection>
  </div>
 <apex:pageBlockSection title="Output Page"  rendered="{!saved1}">
 <apex:pageBlockTable value="{!reportlist}" var="acc"> 
 
 <apex:column headerValue="Report Name"> 
<apex:outputField value="{!acc.Report_Name__c}" />
 </apex:column> <br/>
  <apex:column headerValue="Comments">
<apex:outputField value="{!acc.Comments__c}" /> 
<br /> </apex:column> 

</apex:pageBlockTable>
 </apex:pageBlockSection>
 <apex:pageBlockButtons > 
<apex:commandButton value="Add Report" action="{!addAccount}"/>
 <apex:commandButton value="Save Report" action="{!saveAccount}"/> 
</apex:pageBlockButtons>
 </apex:pageBlock> 
</apex:form>
</apex:page>

Apex Class :-

public class TestTaskController1 {

Report_Information__c task = new Report_Information__c();
Public boolean saved {get; set;}
Public boolean saved1 {get; set;}
public String parentId;

public list<Report_Information__c> reportlist{ get; set; }

    public TestTaskController1(ApexPages.StandardController controller) {
              reportlist=new list<Report_Information__c>();
              parentId= controller.getId();
              reportlist = [SELECT id,Report_Name__c,Comments__c,ATask__c from Report_Information__c where ATask__c=:parentId];              
              reportlist.add(task);
              saved=true;
              saved1 = false;
            
              
    }


Public void addAccount()
{
Report_Information__c acc = new Report_Information__c();
reportlist.add(acc);
saved=true;
saved1=false;
}


public PageReference saveAccount() {
for(Report_Information__c  re :reportlist)
{

re.ATask__c= parentId;
}

if(reportlist.size()>1){
insert reportlist;
saved=false;
saved1= true;


}

return null;

}}

My VF page :-

User-added image
Hi All,

i have two objects 
1. Assigned task - parent object
2. Report Information - child object

I have created a VF page and placed it on the Assigned Task detail page.
My Vf Page has two buttons
1. Add Report - which adds a new dynamic section
2. Save Report - Save all the data in Dynamic section

I am successfull in creating dynamic text boxes but I'm not able to save them. Could anyone please help me that how should I save my child records based on the id of the parent object.
My VF code is : - 
<apex:page standardcontroller="Assigned_tasks__c" extensions="TestTaskController1"> 
<apex:form > 
<apex:pageBlock > <
apex:pageBlockTable value="{!reportlist}" var="acc"> 
<apex:column headerValue="Report Name"> 
<apex:inputField value="{!acc.Report_Name__c}" rendered="{!NOT(saved)}"/> 
<apex:outputField value="{!acc.Report_Name__c}" rendered="{!saved}"/>
 <br /> </apex:column> <apex:column headerValue="Comments">
 <apex:inputField value="{!acc.Comments__c}" rendered="{!NOT(saved)}"/> 
<apex:outputField value="{!acc.Comments__c}" rendered="{!saved}"/> 
<br /> </apex:column> </apex:pageBlockTable>
 <apex:pageBlockButtons > 
<apex:commandButton value="Add Report" action="{!addAccount}"/>
 <apex:commandButton value="Save Report" action="{!saveAccount}" /> 
</apex:pageBlockButtons>
 </apex:pageBlock> 
</apex:form> 
</apex:page>

and APEX code is :- 

public class TestTaskController1 {

Report_Information__c task = new Report_Information__c();
Public boolean saved {get; set;}

public list<Report_Information__c> reportlist{ get; set; }

    public TestTaskController1(ApexPages.StandardController controller) {
              reportlist=new list<Report_Information__c>();
              reportlist.add(task);
              saved=false;
    }


Public void addAccount()
{
Report_Information__c acc = new Report_Information__c();
reportlist.add(acc);
}


public PageReference saveAccount() {
for(Integer i=1; i<reportlist.size(); i++)
{

insert reportlist;
saved=true;
}

 return Page.Allassigned;
}

}

Snapshot of my VF page which will be placed on Parent object.

User-added image
I have two objects : 1. Assigned_Task__c object
2. Migration_Report__C object 1 is parent of 2

I have a custom button on Assigned Task object Generate Migration List My requirement is when i click on this button all the related records to one particular task are exported to excel sheet. As you can see below i have this button , so when i click on this i want that the information in the related record comes in an excel sheet. Can anyone please help me with this code. Thanks in advance. 

User-added image
Hi,

I have a VF page in which I am saving and adding the values through two buttons. 
Buttons are working fine. when i click the add button, a new row is added and when i click on save button,data is saved in Read only mode. But when i refresh the page , the values are saved in edit mode and not in read only mode. So, my questions is how to Save the Data in Read only mode on Page refresh. 
My Vf Page code :- 
<apex:page standardcontroller="Assigned_tasks__c" extensions="TestTaskController1">
<apex:form >
<apex:pageBlock > 
<div id="hide">
 <apex:pageBlockSection title="Input Page" id="pgsec" rendered="{!saved}">
<apex:pageBlockTable value="{!reportlist}" var="acc"> 
<apex:column headerValue="Report Name"> 
<apex:inputField value="{!acc.Report_Name__c}" /> 

 <br /> </apex:column> 
  <apex:column headerValue="Comments">
 <apex:inputField value="{!acc.Comments__c}"/> 
 </apex:column> 
 <br/>
 </apex:pageBlockTable>
  </apex:pageBlockSection>
  </div>
 <apex:pageBlockSection title="Output Page"  rendered="{!saved1}">
 <apex:pageBlockTable value="{!reportlist}" var="acc"> 
 
 <apex:column headerValue="Report Name"> 
<apex:outputField value="{!acc.Report_Name__c}" />
 </apex:column> <br/>
  <apex:column headerValue="Comments">
<apex:outputField value="{!acc.Comments__c}" /> 
<br /> </apex:column> 

</apex:pageBlockTable>
 </apex:pageBlockSection>
 <apex:pageBlockButtons > 
<apex:commandButton value="Add Report" action="{!addAccount}"/>
 <apex:commandButton value="Save Report" action="{!saveAccount}"/> 
</apex:pageBlockButtons>
 </apex:pageBlock> 
</apex:form>
</apex:page>

Apex Class :-

public class TestTaskController1 {

Report_Information__c task = new Report_Information__c();
Public boolean saved {get; set;}
Public boolean saved1 {get; set;}
public String parentId;

public list<Report_Information__c> reportlist{ get; set; }

    public TestTaskController1(ApexPages.StandardController controller) {
              reportlist=new list<Report_Information__c>();
              parentId= controller.getId();
              reportlist = [SELECT id,Report_Name__c,Comments__c,ATask__c from Report_Information__c where ATask__c=:parentId];              
              reportlist.add(task);
              saved=true;
              saved1 = false;
            
              
    }


Public void addAccount()
{
Report_Information__c acc = new Report_Information__c();
reportlist.add(acc);
saved=true;
saved1=false;
}


public PageReference saveAccount() {
for(Report_Information__c  re :reportlist)
{

re.ATask__c= parentId;
}

if(reportlist.size()>1){
insert reportlist;
saved=false;
saved1= true;


}

return null;

}}

My VF page :-

User-added image
Hi All,

i have two objects 
1. Assigned task - parent object
2. Report Information - child object

I have created a VF page and placed it on the Assigned Task detail page.
My Vf Page has two buttons
1. Add Report - which adds a new dynamic section
2. Save Report - Save all the data in Dynamic section

I am successfull in creating dynamic text boxes but I'm not able to save them. Could anyone please help me that how should I save my child records based on the id of the parent object.
My VF code is : - 
<apex:page standardcontroller="Assigned_tasks__c" extensions="TestTaskController1"> 
<apex:form > 
<apex:pageBlock > <
apex:pageBlockTable value="{!reportlist}" var="acc"> 
<apex:column headerValue="Report Name"> 
<apex:inputField value="{!acc.Report_Name__c}" rendered="{!NOT(saved)}"/> 
<apex:outputField value="{!acc.Report_Name__c}" rendered="{!saved}"/>
 <br /> </apex:column> <apex:column headerValue="Comments">
 <apex:inputField value="{!acc.Comments__c}" rendered="{!NOT(saved)}"/> 
<apex:outputField value="{!acc.Comments__c}" rendered="{!saved}"/> 
<br /> </apex:column> </apex:pageBlockTable>
 <apex:pageBlockButtons > 
<apex:commandButton value="Add Report" action="{!addAccount}"/>
 <apex:commandButton value="Save Report" action="{!saveAccount}" /> 
</apex:pageBlockButtons>
 </apex:pageBlock> 
</apex:form> 
</apex:page>

and APEX code is :- 

public class TestTaskController1 {

Report_Information__c task = new Report_Information__c();
Public boolean saved {get; set;}

public list<Report_Information__c> reportlist{ get; set; }

    public TestTaskController1(ApexPages.StandardController controller) {
              reportlist=new list<Report_Information__c>();
              reportlist.add(task);
              saved=false;
    }


Public void addAccount()
{
Report_Information__c acc = new Report_Information__c();
reportlist.add(acc);
}


public PageReference saveAccount() {
for(Integer i=1; i<reportlist.size(); i++)
{

insert reportlist;
saved=true;
}

 return Page.Allassigned;
}

}

Snapshot of my VF page which will be placed on Parent object.

User-added image
I have two objects : 1. Assigned_Task__c object
2. Migration_Report__C object 1 is parent of 2

I have a custom button on Assigned Task object Generate Migration List My requirement is when i click on this button all the related records to one particular task are exported to excel sheet. As you can see below i have this button , so when i click on this i want that the information in the related record comes in an excel sheet. Can anyone please help me with this code. Thanks in advance. 

User-added image
Hi @all,

I created a VF-page and if the user press on the save button, then the page should save the values (this is working fine) and refresh themself like pressing F5 on keyboard. Is this possible?

Regards
Robert

Hello Everyone,

 

  I have a requirement, when users fills the data in the VF Page and clicks save/submit button, after clciking the VF Page should be Read-only and should not be editable.

 

Please help me out

 

 

Thanks

 

Hi

 

I have a VF page where in I am using case standard controller.

The first time when the page is displayed 2 input fields (eg.) are there i.e. Name and Email. which are static. Another 2 fields are their like Vendor Name and Vendor Contact No. which are dynamic.

 

Now, I want to implement the functionality wherein if a user clicks on Add Row button,  1more row will appear to enter a value in both  the fields(Vendor name and Vendor Contact No.). So, if he clicks the button 5 times, 5 rows shud appear with thses two columns.

After providing the inputs, he will click on "Save " button, and the record should be saved wherein the inputs provided in multiple rows should be saved into the related list of the Case detail page (Case details page will contain the information like Name and Email). Request you to please forward me the code for the above mentioned functionality. Since its a n urgent requirement. An early reply will be highly appreciated. Thanks.

  • May 07, 2010
  • Like
  • 0