You need to sign in to do that
Don't have an account?
Howard Weinstein
Issue Saving Data from Custom Controller Using InputTextArea
I have a large form with many different entries that the user is able to make entries for. Each item has its own save button. See example below
My issue is that I am using a table structure for my custom so that every category has the same fields and is differentiated by the field values
In my method I am filtering through to idenitfy the current period entry for the category and placing it in an inputtextarea
Then in my apex page I display the data
I then have a Save function in the controller that should save the current info to update the record but I am having several issues:
1) the data is not getting updated to any record in the list
2) the current record is not differentiated by the different categories
I can't figure out how to let the controller receive the current inputtextarea the user is updating from the VFpage. If I was able to isolate that I think I could then pass that back to the controller so it knows what to update
My issue is that I am using a table structure for my custom so that every category has the same fields and is differentiated by the field values
In my method I am filtering through to idenitfy the current period entry for the category and placing it in an inputtextarea
Then in my apex page I display the data
I then have a Save function in the controller that should save the current info to update the record but I am having several issues:
1) the data is not getting updated to any record in the list
2) the current record is not differentiated by the different categories
I can't figure out how to let the controller receive the current inputtextarea the user is updating from the VFpage. If I was able to isolate that I think I could then pass that back to the controller so it knows what to update
I will say this though, if you have multiple forms that are the same or very similar, this is an excellent candidate for a Visualforce component. Visualforce components can have their own controllers (and also you could easily make it so that each component has it's own "scope" with a save button for the form).
So here's something you could try (again I'm making an assumption here since I haven't seen much of your VF or Apex):
- Move the text area and save button into a Visualforce component with its own controller.
- The controller would contain a "save" method of its own that saves a single instance of SDR_Answer__c.
- The commandButton that performs the save, uses the rerender attribute to rerender that specific component / form row / input text area.
- In your visualforce page, you loop through the list of SDR_Answer__c records, and for every instance you call the Visualforce component, passing in the instance as a parameter in your component.
If you're still having issues getting your logic to work, a good first step is adding System.debug statements to your controller methods, and opening a debug log (Setup->Monitoring->Debug Log), which will help narrow down any errors that occur.