我在2个按钮上创建了2个弹出窗口。并拥有一个物体(AC)。在这两个弹出窗口中,我都有一些字段要插入。
在第一个弹出窗口中,它包含A.name1、A.name2、A.date、A.Edate、A.Pjt等;在第二个弹出窗口中,我有字段A.Name1、A.name2。A.Name1和A.name2是对象中的必需字段。
我的问题是,当我试图在第一个弹出窗口中插入值时,我得到了错误meg,即“您必须输入A值”,但即使这样,我也输入了该值。因此,我注释了第二个弹出,然后它运行良好,但是当第二个弹出式弹出取消注释时,这个错误被抛出事件,值被输入。第二个弹出窗口在第一个字段和其他字段中包含相同的两个字段。
有人能帮我找到这个错误的解决方案吗。
<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="name1: " />
<apex:inputfield id="proj" value="{!AC.name1__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="name2: " />
<apex:inputfield id="role" value="{!AC.name2__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="name1: " />
<apex:inputfield id="proj1" value="{!AC.name1__c}" />
</apex:pageblocksectionitem><p/>
<apex:pageblocksectionitem >
<apex:outputlabel value="Date: " />
<apex:inputfield id="sd" value="{!AC.Date__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="EDate: " />
<apex:inputfield id="ed" value="{!AC.EDate__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="Proj: " />
<apex:inputfield id="pl" value="{!AC.Pjt__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="Charge: " />
<apex:inputfield id="charge" value="{!AC.Charge__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="Name2: " />
<apex:inputfield id="role1" value="{!AC.name2__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="time: " />
<apex:inputfield id="overtime" value="{!AC.time__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>
</apex:outputPanel>发布于 2012-08-13 13:56:37
我认为这是因为在两个弹出窗口中有相同的对象。如果你输入一个值,例如。第一个弹出窗口中的name1_c --第二个弹出窗口中的另一个字段name1_c仍然是空的。
尝试创建对象的两个不同实例:
顶点级:
public YourObject AC1 { get; set; }
public YourObject AC2 { get; set; }
// Constructor
public YourClassName(){
AC1 = new YourObject();
AC2 = new YourObject();
}第一个弹出窗口:
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp1}">
<apex:pageblock >
<apex:pageBlockButtons>
<apex:commandbutton value="Assign to a New Project" action="{!assign1}" />
<apex:commandbutton value="Cancel" action="{!closePopup1}" immediate="true" />
</apex:pageBlockButtons>
<apex:pageblocksection >
<apex:pageblocksectionitem >
<apex:outputlabel value="name1: " />
<apex:inputfield id="proj1" value="{!AC1.name1__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="Name2: " />
<apex:inputfield id="role1" value="{!AC1.name2__c}" />
</apex:pageblocksectionitem>
<!-- other fields from the instance 1 of the object -->
....
</apex:pageblocksection>
<apex:pageblock >
<apex:outputPanel>第二个弹出窗口:
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp2}">
<apex:pageblock >
<apex:pageBlockButtons>
<apex:commandbutton value="Assign to a Another Project" action="{!assign2}" />
<apex:commandbutton value="Cancel" action="{!closePopup2}" immediate="true" />
</apex:pageBlockButtons>
<apex:pageblocksection >
<apex:pageblocksectionitem >
<apex:outputlabel value="name1: " />
<apex:inputfield id="proj2" value="{!AC2.name1__c}" />
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
<apex:outputlabel value="Name2: " />
<apex:inputfield id="role2" value="{!AC2.name2__c}" />
</apex:pageblocksectionitem>
<!-- other fields from the instance 2 of the object -->
....
</apex:pageblocksection>
<apex:pageblock >
<apex:outputPanel>https://stackoverflow.com/questions/11933660
复制相似问题