I'm fairly new to this, so I apologize if this is an obvious question, but I haven't been able to find answers after an extensive search. Thanks in advance for your help!
I have a dataTable that contains inputfields for multiple objects (all saved to a very basic wrapper class that I hopefully set up correctly) and some columns are only rendering if a specific value is selected in the selectList. My problem is that when I save the fields, everything is coming through as null even if a value is entered (I instantiated the fields in my wrapper class to test and the instantiated values replace null, so I'm wondering if I have something wrong with the order?).
Here are a couple brief snippets of what I believe is the applicable code.
Visualforce (not in it's entirety, let me know if I need to provide more):
<apex:form >
<apex:actionRegion >
<apex:pageblock id="pb">
<apex:dataTable value="{!lstInner}" var="e" columns="9" id="taskTable" headerClass="sectionHeader" width="100%">
<apex:column rendered="{!renderActivity}">
<apex:facet name="header">Subject</apex:facet>
<apex:inputfield value="{!e.myActivity.Subject}"/>
</apex:column>
<apex:column> <!--ALWAYS RENDERED AND USED FOR myActivity AND myOtherActvity IN CONTROLLER-->
<apex:facet name="header">Subject</apex:facet>
<apex:inputfield value="{!e.myActivity.Description}"/>
</apex:column>
<apex:column rendered="{!renderOther}">
<apex:facet name="header">Subject</apex:facet>
<apex:inputfield value="{!e.myOtherActivity.Subject}"/>
</apex:column>
</apex:dataTable>
</apex:pageblock>
</apex:actionRegion >
</apex:form >
Controller and wrapper (not in it's entirety, let me know if I need to provide more):
public with sharing class MyController{
public MyController() {
lstInner = new List<innerClass>();
}
public class innerClass {
public String recCount {get; set;}
public Activity myActivity {get; set;}
public OtherActivity myOtherActivity {get; set;}
public innerClass(){
myActivity = new Activity();
myOtherActivity = new OtherActivity ();
}
public PageReference save() {
if (lstInner.size() > 0){
for (Integer a = 0; a < lstInner.size(); a++){
if (lstInner[a].myActivityType == 'Other'){
OtherActivity oa = new OtherActivity();
oa.Subject = lstInner[a].myOtherActivity.Subject;
oa.Description = lstInner[a].myActivity.Description;
} else if (lstInner[a].myActivityType == 'Activity'){
Activity a = new Activity();
a.Subject = lstInner[a].myActivity.Subject;
a.Description = lstInner[a].myActivity.Description;
}
}
}
}
}