某些字段未从 VF 页面捕获

发布于 2024-12-15 03:02:53 字数 3569 浏览 0 评论 0 原文

我有一个 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>

类有这个

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

  }

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>

Class has this

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

  }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明媚如初 2024-12-22 03:02:53

本教程有点过时,但我认为它可能有助于解释与您尝试执行的操作相关的一些问题:教程:Visualforce 中的模态对话框

“构建链接或按钮来弹出新的 Visualforce 页面实际上是
非常简单,让这个弹出窗口位于当前页面上方是
也很容易。当你想收集时就会出现问题
弹出窗口中的信息并将该信息传递回页面
启动了弹出窗口。”

This tutorial is a little dated, but I think it might help explain some of the issues associated with what you're trying to do: Tutorial: Modal Dialogs in Visualforce.

"Building a link or button to popup a new Visualforce page is actually
quite simple, and getting this popup to be above the current page is
also quite easy. The problem occurs when you would like to collect
information in the popup and pass that information back to the page
that launched the popup."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文