You need to sign in to do that
Don't have an account?
Jeremy Blodgett
VF Page with link or button to add more fields as necessary.
Hi all, I am new to coding and could use some help. I am trying to develop a vf page for a custom object I created. I have 10 custom text fields to enter material names, the catch is I only want to initially show 5 fields, then click a button or link to add the remaining 5 fields if necessary. Is it possible? Thanks!
Yes there is a way to implement your requirement.
The solution is to use a class variable that changes value when clicked on a particular button. So when that button is clicked only then the required components like fields, texts etc are rendered on the VF Page.
Here are the sample VF Page and the Controller Class -
VF Page
Controller Class
These examples are working, so you can even just copy paste and check them out.
Thanks
AR
If this reply solves your problem then please mark it as best answer.
Were you able to implement the solution?
AR
I just tried your code, its working, but how its fulfilling Jeremy's query.
You have given Output text and its just showing and hiding that text value.
Please suggest solution for fields(showing and hiding limited fields as per requirement).
Waiting for your response.
Regards
Manav
That was just an example. You can place whatever VF Component instead of the <apex:outputText>.
Like -
This will show the Contact First Name field as editable field. When you modify it and save the record, it will be saved.
Thanks
AR