function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ZurMilesZurMiles 

Apex form question

Hello all,

 

I have a question regarding a form I want to build with Apex and Visualforce pages.

The form will have 1 row and 4 columns but I want  to allow the user to add more rows if needed.

The question is, what would be the best way to automatically add a new row when the user enters data on the first row?

Could anyone give me a few examples please?

Thanks in advanced!

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I wrote up a blog post about this scenario at:

 

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

 

It probably won't match your use case exactly, but should be readily adaptable.

All Answers

bob_buzzardbob_buzzard

I wrote up a blog post about this scenario at:

 

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

 

It probably won't match your use case exactly, but should be readily adaptable.

This was selected as the best answer
ZurMilesZurMiles
Thanks Bob, I'm looking to that post, lets see how far can I go :) ... thanks
ZurMilesZurMiles

Hello again, 

 

Bob, thank you so much for your link. 

This is definitely of great help, but there is always a but ....  I was wondering if there is a way to use this script to just grab Strings. 

The form is part of a visualforce page that it is used as a web service for clients to report a damage product. There is not any insert or upset in any of our objects.

My idea is to grab the data from that form and send it to a specify email address. All this works fine. 

 

Please, correct me if I'm wrong, but I think that is not possible to use your scripts and change the SObject for a collection of primary data like an array.

I was wondering if it is possible to use this:

 

 

public List<String> wrappers {get; set;}

 instated of this.

 

 

public List<AccountWrapper> wrappers {get; set;}

 It is obvious that there are going to be a lot modifications, but is this possible?

 

I have been looking around and I feel that this is not possible but I was wondering if you can probe me wrong, that will be good news :) 

 

Thanks again for you help.

 

 

bob_buzzardbob_buzzard

That would be possible.  You can just iterate the strings and use those as merge fields on inputtext elements.  However, if you use a wrapper class then you can build more of a structured form as you would know which field you are binding to the textarea, rather than just iterating a list.

 

ZurMilesZurMiles

Thanks Bob, your help is much appreciated.

 

Regards.