You need to sign in to do that
Don't have an account?

Add Row functionality in VisualForce
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.
i had done something similar earlier...following is the code snipplet...i did it for accounts...following is the code snipplet...
VF Page :
Apex Controller :
I hope this helps...
All Answers
i had done something similar earlier...following is the code snipplet...i did it for accounts...following is the code snipplet...
VF Page :
Apex Controller :
I hope this helps...
Hi
Thanks for the prompt reply. It helped me a lot.
But in contuation with this issue, While adding rows on the VF Page, attachment should also be included in that row. So, whenever user clicks on "Add Row " Button, he should be able to view all the input fields along with the field used for attachment.
I have implemented this, the problem here is after providing input in all the fields + attachment field, when the user clicks on Add Row Button, the value in all the fields persist except Attachment field. Even rerender cannot be used for inputfile.
Please let me know any work around for the same.
Thanks.
This is awesome. I tweaked the code a bit though so that the rows could all be removed out of order. There was an issue where if you added more than 1 row and then deleted them out of order, it would throw an error.
I also tweaked it so that the existing records on a related list would already be in the list when the page loads...and clicking the add button adds a row to the bottom of the related list. Also, the user can click an "edit" button next to each line that puts the existing records in the related list into edit mode.
Your base code sample was a lifesaver - let me know if you're interested in seeing how I tweaked it (I'd post it now, but I'm still cleaning up my mess).
I am Glad that it helped you. Please do send me the modified code at spd101287@gmail.com if you have finished up the housekeeping :)
Thanks,
Shailesh.
would you mind posting the modified code here?
I did some extensions on your code also, but i am having some errors, example i cannot remove the new line item as the fields are required.
vf page
extension
Here's the page/Class... apologies for the formatting getting a little messed up in the class...something got misaligned in the translation between eclipse and the browser. Also, there might be missing methods here and there because I took it out of a class that was too big to post...a lot of jQuery references and things in general that weren't applicable/necessary...but the important parts of it should be there...
Apex Page:
Class:
Hi,
I am new to this kindly let me know how can I add pagination to this code. I have a similar requirement where I need to display 4 records to be added on single page.
Please suggest.
Thanks in advance.
Regards,
Sane
@JPlayEHR @Shailesh Deshpande would you mind to email me the full class and vf page? anurag.shah@hotmail.com thanks I have a very simillar need and I am new in SalesForce
I copied what is shown above but getting a Compilation error: Invalid type: Innerclass at line 10 in your code above. Any thought as to why?
I have a similar need.
Thanks in advance. :)
What I'm looking for something similar. For the same I have posted a question here - https://goo.gl/62qGiR
I appreciate your help.
Thank you.
You can use below code for add dynamic multiple rows:
VF Page:
Apex Controller:
I hope this will help you.
Thanks.
מה עושים כשיש הודעה כזו
DML requires SObject or SObject list type: List<Object>