某些字段未从VF页面捕获

时间:2011-11-10 05:06:27

标签: salesforce apex-code

我有一个VF页面,其中有一个弹出窗口可以接受几个字段。

当我运行页面并填写字段时,我可以看到只有一些字段值被捕获,其他字段值返回为null。我交叉检查字段名称,它们是相同的。任何想法为什么会发生这种情况?

<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>

Class有这个

    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);   

  }

1 个答案:

答案 0 :(得分:0)

本教程有点过时,但我认为它可能有助于解释与您尝试执行的操作相关的一些问题:Tutorial: Modal Dialogs in Visualforce

  

“实际上,构建一个链接或按钮以弹出一个新的Visualforce页面   很简单,让这个弹出窗口高于当前页面是   也很容易。当您想要收集时会出现问题   弹出窗口中的信息并将该信息传递回页面   推出了弹出窗口。“