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
pradyprady 

some fields not getting captured from VF page

I have a VF page which has a popup to accept a few fields.

When I run the page and fill in the fields, I can see that only some field values are getting captured, others are returining as null. I cross checked the field names, they are the same. Any ideas why this could happen?



<apex:outputPanel id="tstpopup1">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
            <apex:pageblock >
                <apex:pageblocksection >
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Project: " />
                    <apex:inputfield id="proj" value="{!AC.Project__c}" />
                    </apex:pageblocksectionitem><p/>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Start Date: " />
                    <apex:inputfield id="sd" value="{!AC.Start_Date__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="End Date: " />
                    <apex:inputfield id="ed" value="{!AC.End_Date__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="C85 Project Lead: " />
                    <apex:inputfield id="pl" value="{!AC.C85_Project_Lead__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Daily Charge Rate of Consultant: " />
                    <apex:inputfield id="charge" value="{!AC.Daily_Charge_Rate_of_Consultant__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Project Role Title: " />
                    <apex:inputfield id="role" value="{!AC.Project_Role_Title__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Overtime Allowed: " />
                    <apex:inputfield id="overtime" value="{!AC.overtime_allowed__c}" />
                    </apex:pageblocksectionitem>
                    </apex:pageblocksection>
                    <apex:commandbutton value="Assign to a New Project" action="{!assign}"   />
                    <apex:commandbutton value="Cancel" action="{!closePopup}" immediate="true" /><br/><br/><br/>
                    </apex:pageblock>
            </apex:outputPanel>

 

    public Assigned_Consultant__c AC{
        get{
            if (AC == null) AC = new Assigned_Consultant__c();
            return AC;
        }
        set; 
    }


public PageReference assign()
{ 
system.debug('Role title ...........................' + AC.Project_Role_Title__c); // this is returning null
            system.debug('Day charge ...........................' + AC.Daily_Charge_Rate_of_Consultant__c); this has value filled
system.debug('overtime_allowed__c ...........................' + AC.overtime_allowed__c);  // this is returning null


         // Project_Role_Title__c
            displayPopup = false;  
            system.debug('inside assign...........................3');
            system.debug('AC.................' + AC);   

  }

 

bob_buzzardbob_buzzard

Do you have any other input field components on the page that are tied to the same AC fields?

pradyprady

mm.. there are 2 popups involved.But only one popup will be active at one point of time. The fields common in

both the popups are AC.Project__c and AC.Project_Role_Title__c. Interestingly i am getting value for Project__c

but not Project_Role_Title__c



<apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
            <apex:pageblock >
                <apex:pageblocksection >
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Project: " />
                    <apex:inputfield id="proj" value="{!AC.Project__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Role: " />
                    <apex:inputfield id="role" value="{!AC.Project_Role_Title__c}" />
                    </apex:pageblocksectionitem>
                    <p/>
                    <apex:commandbutton value="Pencil in a New Project" action="{!save}"   />
                    <apex:commandbutton value="Cancel" action="{!closePopup}" immediate="true" /><br/><br/><br/>
                    </apex:pageblocksection>
                    </apex:pageblock>
            </apex:outputPanel>
        </apex:outputPanel>
        
     <apex:outputPanel id="tstpopup1">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
            <apex:pageblock >
                <apex:pageblocksection >
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Project: " />
                    <apex:inputfield id="proj" value="{!AC.Project__c}" />
                    </apex:pageblocksectionitem><p/>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Start Date: " />
                    <apex:inputfield id="sd" value="{!AC.Start_Date__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="End Date: " />
                    <apex:inputfield id="ed" value="{!AC.End_Date__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="C85 Project Lead: " />
                    <apex:inputfield id="pl" value="{!AC.C85_Project_Lead__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Daily Charge Rate of Consultant: " />
                    <apex:inputfield id="charge" value="{!AC.Daily_Charge_Rate_of_Consultant__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Project Role Title: " />
                    <apex:inputfield id="role" value="{!AC.Project_Role_Title__c}" />
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                    <apex:outputlabel value="Overtime Allowed: " />
                    <apex:inputfield id="overtime" value="{!AC.overtime_allowed__c}" />
                    </apex:pageblocksectionitem>
                    </apex:pageblocksection>
                    <apex:commandbutton value="Assign to a New Project" action="{!assign}"   />
                    <apex:commandbutton value="Cancel" action="{!closePopup}" immediate="true" /><br/><br/><br/>
                    </apex:pageblock>
            </apex:outputPanel>

 

bob_buzzardbob_buzzard

Thing is, even if the popups aren't displayed, the input fields will still be submitted back to the controller unless you use actionregion tags to stop that.

pradyprady

Bob,

 

If you see the popups, both have the fields AC.Project__c and AC.Project_Role_Title__c. I get the value of Project__c  but not Project_Role_Title__c. 

 

Not sure how that should work.

do you think its best to capture values in input text and then assign them into AC?

bob_buzzardbob_buzzard

You can't guarantee the order that the setters will be called in I'm afraid, so I would expect you wouldn't see consistency here.

 

The <apex:actionRegion> component is built for this situation - effectively it breaks your form into sections that operate independently of each other.