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> <!--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 rendered="{!renderOther}">
                    <apex:facet name="header">Subject</apex:facet>
                    <apex:inputfield value="{!e.myOtherActivity.Subject}"/>
    </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;
  • how is the save action invoked? – Antonio Manente Jun 2 '16 at 18:31
  • 1
    Thank you so much! I had it in a separate form just under this code. I moved it inside the form and it works perfectly now. Your simple question gave me an effective solution. Thanks a lot and sorry that it ended up being a stupid question after all :) – mplax Jun 2 '16 at 18:40
  • No worries, glad I could help! – Antonio Manente Jun 2 '16 at 19:31
  • Please do answer below, Antonio. I held off creating the answer so you could get the credit. – mplax Jun 7 '16 at 15:10

Credit to Antonio Manente

The solution was to move the save action, invoked by a commandButton, inside the form that contained by inputfields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.