+ Start a Discussion
rtandon17@gmail.comrtandon17@gmail.com 

Need help on developing custom visual force page and dynamic input table form for user input.

 


Hi, I am very new to salesforce and donot have much idea on apex coding/vf, I am looking for sample code & Suggestions to develop the below problem description as i need to develop and deliver this at the earliest.
Please help, Thank you!

Problem Description:
I need to develop custom visual force page where in the user can enter values in a form like page for various fields
and can also enter values in the dynamic table ie. the user can add any number of rows the the table and then the
user can save the form.

Fields: Accnt field -> is a field value from account object through master details relation ship b/w account and this object (say X).
Object X: for which the vf page is to be developed contains fields (fields2, fields 3, fields 4 and fields 5)

Table Name: is a separate object which is related to Object X.


I need to create a form which looks like the attach screen print so that the user can enter values
save/update etc. The user should be able to add/delete update multiple records in the table and the
records should related to the object X for each acc and related records should be displayed on view and can also be edited.

Also, i have just provided first section detail of the form to be developed, the remaining pages of the form is exactly replication of this page with differnt fields of
object X and then related tables of different object.


The table needs to be developed so that the user can add dynamically any number of rows or date or delete etc with buttons or any suggestions.

Any suggestions on data definition is also welcomed. thank you so much for the help.

Ashish_SFDCAshish_SFDC

Hi R Tandon, 

 

You have to create a Visualforce page that displays the form and also a controller with apex code in it which has the logic to add the records, i am pasting a sample below also go the links for additional information. 

 

 VF Code:

                                                 <apex:page controller="cls_dynamicrow">

                                                  <apex:form>

                                                  <apex:outputPanel id = "refreshdata">

                                                   <apex:repeat value="{!propLstQuesAns}" var="varLQA" id="textquesrp">

                                                   <p>

                                                                <apex:inputtext value="{!varLQA.propAns}" id="textques"/></p>

                                                   </apex:repeat>

                                                   </apex:outputPanel>

                                                   <apex:commandButton action="{!DynamicRow}" reRender="refreshdata" value="ADD ROW"/>

                                                  </apex:form>

                                                </apex:page>

 

Controller code:

                                                public class cls_dynamicrow

                                                {

                                                  public List<WrapperQueAns> lstQueAns = new List<WrapperQueAns>{};

                                                  public List<WrapperQueAns> propLstQuesAns { get { return lstQueAns; } set { lstQueAns = value; } }

                                                  Public cls_dynamicrow(){

                                                                WrapperQueAns wqa = new WrapperQueAns();

                                                                wqa.propAns = '';

                                                                lstQueAns.add(wqa);

                                                  }

                                                  public void DynamicRow(){

                                                                for(Integer i=0;i<5;i++){

                                                                  WrapperQueAns wqa = new WrapperQueAns();

                                                                  wqa.propAns    = '';

                                                                  lstQueAns.add(wqa);

                                                                }

                                                  }

                                                  public class WrapperQueAns{public String propAns   { get; set; } }//End Class WrapperQueAns

                                                }

 

http://boards.developerforce.com/t5/General-Development/Adding-multiple-records-in-one-vf-page/td-p/611813

 

http://boards.developerforce.com/t5/Visualforce-Development/Add-Row-functionality-in-VisualForce/m-p/183217#M24139

 

http://bobbuzzard.blogspot.in/2011/07/managing-list-of-new-records-in.html

 

 

Regards,

Ashish