Error Message when popup window is loaded - salesforce

I have created 2 popup on 2 button. And have a object (AC). On both popup I have some fields to insert.
In 1st popup it contain A.name1, A.name2, A.date, A.Edate, A.Pjt etc and in 2nd popup I have fields A.Name1, A.name2. The A.Name1 and A.name2 are required field in object.
My problem is that when I try to insert the value in the 1st popup I am getting error meg that "YOU MUST ENTER A VALUE" but even then i enter the value. So I commented the 2nd popup then it is working fine but when 2nd popup is uncommented the this error is thrown event the value is entered. The 2nd popup contains the same 2 fields in the first with some other fields.
can anybody help me to find the solution for this error.
<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>

I think this is because you have the same object in two popups. If you enters a value eg. name1_c in your first popup - the other field name1_c in your second popup is still empty.
Try to create two diferent instances of your object:
Apex class:
public YourObject AC1 { get; set; }
public YourObject AC2 { get; set; }
// Constructor
public YourClassName(){
AC1 = new YourObject();
AC2 = new YourObject();
}
First popup:
<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>
Second popup:
<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>

Related

im trying to add commandLink to my visualforce form but it doesnt exist

im trying to add commandlink to my vf pageblock table but its not even exist. I get 0 error in developer console but it doesnt work. i tried to add it into column and it doesnt work tried alot of things please help me
<apex:page standardController="Account" >
<apex:form >
<apex:pageBlock title="Account Primary Contact" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{! Account.Name }"/>
<apex:inputField value="{! Account.Phone }"/>
<apex:inputField value="{! Account.ID }"/>
<apex:inputField value="{! Account.Type}"/>
<apex:inputField value="{! Account.Phone }"/>
<apex:inputField value="{! Account.AccountNumber }"/>
<apex:inputField value="{! Account.Active__c }"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:pageBlock title="Search Related Contacts">
<apex:pageBlockSection ></apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock title="Related Contacts">
<apex:form>
<apex:pageBlockTable value="{!Account.contacts}" var="contact">
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.Title}"/>
<apex:column value="{!contact.Phone}"/>
<apex:column value="{!contact.Is_Primary_Contact__c}"/>
<apex:commandLink action="{!save}" value="set"/>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
</apex:page>

Multiple buttons with same action

In my VF page I have 7 sections that represent days in a week. Every section has "Add multiple timesheet item" button. When that button is clicked, new row shows up with fields to fill(Project, Number of working hours..). So, I have 7 buttons with same action, and when I click, for example, on button in 1st section, action executes in every section, and I don't want that. I want executing only in section where button was clicked.
This is my code in VF page:
<apex:page Controller="TimesheetController">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Monday" columns="1">
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Tuesday" columns="1">
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}" />
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Wednesday" columns="1">
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Thursday" columns="1">
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}" />
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Friday" columns="1">
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}" />
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Saturday" columns="1" >
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}" />
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Sunday" columns="1">
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!listItems}" var="sheet_item">
<apex:column headerValue="Assignment">
<apex:inputField value="{!sheet_item.Assignment__c}"/>
</apex:column>
<apex:column headerValue="Number of Hours">
<apex:inputField value="{!sheet_item.Number_of_Hours__c}"/>
</apex:column>
<apex:column headerValue="Description">
<apex:inputTextarea value="{!sheet_item.Description__c}" rows="5" cols="30"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Add Timesheet Item" action="{!addItem}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="Contentment, PTO" columns="1">
<br/>
<apex:inputField label="Mood" value="{!timesheet.Mood__c}"/>
<br/>
<apex:inputTextarea label="Upcoming PTO" value="{!timesheet.Upcoming_PTO__c}" rows="5" cols="30"/>
<br/>
<apex:inputTextarea label="Comment" value="{!timesheet.Comment__c}" rows="5" cols="30"/>
<br/>
<apex:outputPanel layout="block" html-align="center">
<apex:commandButton value="Submit" action="{!saveDetails}" style="float:centre" />
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
And this is my Controller:
public class TimesheetController{
Timesheet_Item__c item = new Timesheet_Item__c();
public list<Timesheet_Item__c> listItems{get; set;}
public Timesheet__c timesheet{get; set;}
public TimesheetController () {
timesheet = new Timesheet__c();
listItems = new list<Timesheet_Item__c>();
listItems.add(item);
}
public void addItem() {
Timesheet_Item__c sheet_item = new Timesheet_Item__c();
listItems.add(sheet_item);
}
public PageReference saveDetails() {
for(Integer i=0; i<listItems.size(); i++) {
insert listItems;
}
insert timesheet;
return null;
}
}
It's not "action executes in every section". You render same variable 7 times. If you enter hours into it as 1,2,3,4,5,6,7 I expect it'll save 7 because that's the last time this is mentioned on the form, this field's value will "win".
You need a list of lists:
List<List<Timesheet_Item__c>> l = new List<List<Timesheet_Item__c>>{
new List<Timesheet_Item__c>(),
new List<Timesheet_Item__c>(),
new List<Timesheet_Item__c>(),
new List<Timesheet_Item__c>(),
new List<Timesheet_Item__c>(),
new List<Timesheet_Item__c>(),
new List<Timesheet_Item__c>()
};
and then in the button action you can pass extra <apex:param> with number from 0 to 6, saying to which one add new item. Just watch out, <apex:commandButton> is bit stupid when passing parameters.
Or maybe a Map<String, List<Timesheet_Item__c>> = new Map<String, List<Timesheet_Item__c>>{ 'Monday' => new List<Timesheet_Item__c>(), ...}; Same principle, pass the map key in the button.

Checkbox not showing at custom datalist in Alfresco

I've been trying to help one of my colleagues with an issue with Alfresco custom datalists. We are using Alfresco Community 5.0.d
We have a custom datalist in which there is a checkbox in one of the fields.
The code in both sides looks the same to us... The file checkbox.ftl is inside the same place in both places, and it is exactly the same file. We have also rebuilt the indices just in case which as far as I have understood it won't be necessary in this case. All the datalist works correctly except the checkbox. We have seen that the 'input type="checkbox"' is not in the view generated at the production side. We have no clue where to look. I'm about to copy all the modified/added file for this matter. If you need any extra information just tell me and I will gladly provide it.
In the test environment, we have managed to make it work using the following code:
<model name="datos:datosModel"
xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Custom Datalist</description>
<author>Maria Royo</author>
<version>1.0</version>
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<!--Import Alfresco Data List Model Definitions -->
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace custom.model should be changed to reflect your own namespace -->
<namespaces>
<namespace uri="datos.datosModel" prefix="datos"/>
</namespaces>
<!-- Tipo de dato combobox -->
<!-- Scope-->
<constraints>
<constraint name="datos:Scope" type="LIST">
<parameter name="allowedValues">
<list>
<value>ESA</value>
<value>IOT</value>
<value>Internal</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<!-- Data list defintions For this model go here -->
<type name="datos:datosTabla">
<title>Document Library</title>
<description>Document Library del EMIS</description>
<parent>dl:dataListItem</parent>
<properties>
<property name="datos:datosID">
<title>Reference</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosTitle">
<title>Title</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosVersions">
<title>Versions</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosIncr">
<title>Increment</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosUpdate">
<title>Last Update</title>
<type>d:date</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosDRD">
<title>DRD Reference</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosScope">
<title>Scope</title>
<type>d:text</type>
<mandatory>false</mandatory>
<constraints>
<constraint ref="datos:Scope" />
</constraints>
</property>
<property name="datos:datosRemarks">
<title>Remarks</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<!-- Type Checkbox -->
<property name="datos:datosDel">
<title>Delivered</title>
<description>Active</description>
<type>d:boolean</type>
</property>
</properties>
<associations>
<association name="datos:datosAttachments">
<title>Link</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:cmobject</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
</types>
This is the code we have at the production environment:
<model name="datos:datosModel"
xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Custom Datalist</description>
<author>Maria Royo</author>
<version>1.0</version>
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<!--Import Alfresco Data List Model Definitions -->
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace custom.model should be changed to reflect your own namespace -->
<namespaces>
<namespace uri="datos.datosModel" prefix="datos"/>
</namespaces>
<!-- Tipo de dato combobox -->
<!-- Scope-->
<constraints>
<constraint name="datos:Scope" type="LIST">
<parameter name="allowedValues">
<list>
<value>ESA</value>
<value>IOT</value>
<value>Internal</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<!-- Data list defintions For this model go here -->
<type name="datos:datosTabla">
<title>E-USOC Document Library</title>
<description>E-USOC Document Library</description>
<parent>dl:dataListItem</parent>
<properties>
<property name="datos:datosID">
<title>Reference</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosTitle">
<title>Title</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosVersions">
<title>Versions</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosIncr">
<title>Increment</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosUpdate">
<title>Last Update</title>
<type>d:date</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosDRD">
<title>DRD Reference</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="datos:datosScope">
<title>Scope</title>
<type>d:text</type>
<mandatory>false</mandatory>
<constraints>
<constraint ref="datos:Scope" />
</constraints>
</property>
<property name="datos:datosRemarks">
<title>Remarks</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<!-- Type Checkbox -->
<property name="datos:datosDel">
<title>Delivered</title>
<description>Delivered</description>
<type>d:boolean</type>
</property>
</properties>
<associations>
<association name="datos:datosAttachments">
<title>Link</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:cmobject</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
</types>
Both files are inside the same directory which is:
/alfresco-5.0.d/tomcat/shared/classes/alfresco/extension
Also, we have this code inside the:
/alfresco-5.0.d/tomcat/shared/classes/alfresco/web-extension/share_config_custom.xml
At test environment the code is as follow:
<config evaluator="model-type" condition="datos:datosTabla">
<forms>
<!-- Create item form -->
<form>
<field-visibility>
<show id="datos:datosID" />
<show id="datos:datosTitle" />
<show id="datos:datosAttachments" />
<show id="datos:datosVersions" />
<show id="datos:datosIncr" />
<show id="datos:datosUpdate" />
<show id="datos:datosDRD" />
<show id="datos:datosScope" />
<show id="datos:datosDel" />
<show id="datos:datosRemarks" />
</field-visibility>
<create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
<appearance>
<field id="datos:datosID">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosTitle">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosAttachments">
<control>
<control-param name="startLocation">{doclib}</control-param>
</control>
</field>
<field id="datos:datosVersions">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosIncr">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosUpdates">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosDRD">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosScope">
<control template="/org/alfresco/components/form/controls/selectone.ftl" />
</field>
<field id="datos:datosDel">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" />
</field>
<field id="datos:datosRemarks">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
<!--Data Grid view-->
<form id="datagrid">
<field-visibility>
<show id="datos:datosID" />
<show id="datos:datosTitle" />
<show id="datos:datosAttachments" />
<show id="datos:datosVersions" />
<show id="datos:datosIncr" />
<show id="datos:datosUpdate" />
<show id="datos:datosDRD" />
<show id="datos:datosScope" />
<show id="datos:datosDel" />
<show id="datos:datosRemarks" />
</field-visibility>
</form>
</forms>
</config>
<!-- Edit view -->
<config evaluator="node-type" condition="datos:datosTabla">
<forms>
Edit marketing item form
<form>
<field-visibility>
<show id="datos:datosID" />
<show id="datos:datosTitle" />
<show id="datos:datosAttachments" />
<show id="datos:datosVersions" />
<show id="datos:datosIncr" />
<show id="datos:datosUpdate" />
<show id="datos:datosDRD" />
<show id="datos:datosScope" />
<show id="datos:datosDel" />
<show id="datos:datosRemarks" />
</field-visibility>
<create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
<appearance>
<field id="datos:datosID">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosTitle">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosAttachments">
<control>
<control-param name="startLocation">{doclib}</control-param>
</control>
</field>
<field id="datos:datosVersions">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosIncr">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosUpdates">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosDRD">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosScope">
<control template="/org/alfresco/components/form/controls/selectone.ftl" />
</field>
<field id="datos:datosDel">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" />
</field>
<field id="datos:datosRemarks">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
And finally the code in the production environment:
<config evaluator="model-type" condition="datos:datosTabla">
<forms>
<!-- Create item form -->
<form>
<field-visibility>
<show id="datos:datosID" />
<show id="datos:datosTitle" />
<show id="datos:datosAttachments" />
<show id="datos:datosVersions" />
<show id="datos:datosIncr" />
<show id="datos:datosUpdate" />
<show id="datos:datosDRD" />
<show id="datos:datosScope" />
<show id="datos:datosDel" />
<show id="datos:datosRemarks" />
</field-visibility>
<create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
<appearance>
<field id="datos:datosID">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosTitle">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosAttachments">
<control>
<control-param name="startLocation">{doclib}</control-param>
</control>
</field>
<field id="datos:datosVersions">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosIncr">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosUpdates">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosDRD">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosScope">
<control template="/org/alfresco/components/form/controls/selectone.ftl" />
</field>
<field id="datos:datosDel">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" />
</field>
<field id="datos:datosRemarks">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
<!--Data Grid view-->
<form id="datagrid">
<field-visibility>
<show id="datos:datosID" />
<show id="datos:datosTitle" />
<show id="datos:datosAttachments" />
<show id="datos:datosVersions" />
<show id="datos:datosIncr" />
<show id="datos:datosUpdate" />
<show id="datos:datosDRD" />
<show id="datos:datosScope" />
<show id="datos:datosDel" />
<show id="datos:datosRemarks" />
</field-visibility>
</form>
</forms>
</config>
<!-- Edit view -->
<config evaluator="node-type" condition="datos:datosTabla">
<forms>
<!-- Edit marketing item form -->
<form>
<field-visibility>
<show id="datos:datosID" />
<show id="datos:datosTitle" />
<show id="datos:datosAttachments" />
<show id="datos:datosVersions" />
<show id="datos:datosIncr" />
<show id="datos:datosUpdate" />
<show id="datos:datosDRD" />
<show id="datos:datosScope" />
<show id="datos:datosDel" />
<show id="datos:datosRemarks" />
</field-visibility>
<create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
<appearance>
<field id="datos:datosID">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosTitle">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosAttachments">
<control>
<control-param name="startLocation">{doclib}</control-param>
</control>
</field>
<field id="datos:datosVersions">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosIncr">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosUpdates">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosDRD">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="datos:datosScope">
<control template="/org/alfresco/components/form/controls/selectone.ftl" />
</field>
<field id="datos:datosDel">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" />
</field>
<field id="datos:datosRemarks">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>

Using columns in a visual force page

I have a record field I am for a revenue breakdown. I need my columns to look like they do in the picture, which is the code I will display, except I need the revenue classification in the left column to be bottom in the right column.
When I try I get errors like cannot more than two child elements under page block items.
<apex:page standardController="EventPackageRevenueBreakdown__c"
extensions="EventPackageRevenueBreakdownExt" standardStylesheets="true"
tabstyle="EventPackageRevenueBreakdown__c">
<apex:form >
<apex:pageBlock mode="edit"
title="Event Package Revenue Breakdown Edit">
<apex:pageblockbuttons >
<apex:commandbutton action="{!save}" value="{!$Label.Package_Save}"></apex:commandbutton>
<apex:commandbutton action="{!SaveAndNew}"
value="{!$Label.Package_SaveAndNew}"></apex:commandbutton>
<apex:commandbutton action="{!cancel}"
value="{!$Label.Package_Cancel}"></apex:commandbutton>
</apex:pageblockbuttons>
<apex:pagemessages ></apex:pagemessages>
<apex:pageblocksection id="PackageEventInformationPBS"
title="{!$Label.Package_Information}">
<apex:pageBlockSectionItem >
<apex:outputpanel layout="block" styleClass="requiredInput"></apex:outputpanel>
</apex:pageBlockSectionItem>
<apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
<apex:inputfield required="true"
value="{!EventPackageRevenueBreakdown__c.UnitPrice__c}"></apex:inputfield>
<apex:inputfield required="true"
value="{!EventPackageRevenueBreakdown__c.Location__c}"></apex:inputfield>
<apex:inputfield required="true"
value="{!EventPackageRevenueBreakdown__c.Name}"></apex:inputfield>
<apex:outputfield value="{!EventPackageRevenueBreakdown__c.BookingPackageEvent__c}" />
<apex:inputfield required="true"
value="{!EventPackageRevenueBreakdown__c.RevenueClassification__c}"></apex:inputfield>
</apex:pageblocksection>
<apex:pageblocksection title="Admin and Gratuity">
<apex:pageBlockSectionItem >
<apex:outputpanel layout="block" styleClass="requiredInput"></apex:outputpanel>
</apex:pageBlockSectionItem>
<apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
<apex:inputfield required="false"
value="{!eventItem.AdminCharge__c}"></apex:inputfield>
<apex:inputfield required="false" value="{!eventItem.Gratuity__c}"></apex:inputfield>
</apex:pageblocksection>
</apex:pageBlock>
</apex:form>
</apex:page>
If the pageBlockSection is set to two columns (the default, I believe) then it lays out it's fields Left->Right, then down a row, then Left->Right again.
To push a field over , you can add an empty pageBlockSectionItem
You should layout out your fields like this:
<apex:pageblocksection id="PackageEventInformationPBS" title="{!$Label.Package_Information}" columns="2">
<apex:inputfield required="true" value="{!EventPackageRevenueBreakdown__c.UnitPrice__c}"/>
<apex:inputfield required="true" value="{!EventPackageRevenueBreakdown__c.Location__c}"/>
<apex:inputfield required="true" value="{!EventPackageRevenueBreakdown__c.Name}"/>
<apex:outputfield value="{!EventPackageRevenueBreakdown__c.BookingPackageEvent__c}"/>
</apex:pageBlockSectionItem> <!-- empty selectItem--> <apex:pageBlockSectionItem/>
<apex:inputfield required="true" value="{!EventPackageRevenueBreakdown__c.RevenueClassification__c}"/>
</apex:pageblocksection>

Rerender a pageblock

If I run the page first time, all pageblocks shows the message "choose an user, account or opp" because nothing is choosen. But if I already have selected a user, account or opp the pageblock will show a list/detail of the account or opp.
If I change the user at the top, I want that all panel/pageblocks will resetet, but how can I do that?
I added all pageblocks to the rerender function, but it doesn't work. What is wrong with my code?
<apex:form >
<apex:pageBlock id="pbUser">
<apex:pageBlockSection >
<apex:OutputPanel >
<apex:selectList value="{!SelectedUserId}" size="1" multiselect="false">
<apex:selectOptions value="{!ListOfUser}" />
<apex:actionSupport event="onchange" action="{!fetchAccounts}" <u><b>rerender="pbAcc, pbOpp, pbOppD"</b></u>/>
</apex:selectList>
</apex:OutputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageblock <u><b>id="pbAcc"</b></u>>
<apex:pageBlockSection rendered="{!IF(AccList.size >0,true,false)}" id="pbsAcc">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block" id="panelAcc">
<apex:pageblocktable value="{!AccList}" var="Acc" onRowClick="highlightAcc(this)">
<apex:column headervalue="Name">
<apex:outputField value="{!Acc.Name}"/>
<apex:actionSupport event="onclick" action="{!fetchOpps}" <u><b>rerender="pbOpp, pbOppD"</b></u>>
<apex:param assignTo="{!SelectedAccountId}" value="{!Acc.Id}" name="SelectedAccountId"/>
</apex:actionSupport>
</apex:column>
<apex:column headervalue="Street">
<apex:outputfield value="{!Acc.BillingStreet}" />
</apex:column>
<apex:column headervalue="City">
<apex:outputfield value="{!Acc.BillingCity}" />
</apex:column>
</apex:pageblocktable>
</apex:outputpanel>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IF(AccList.size <1,true,false)}">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block">
Choose a User.
</apex:outputpanel>
</apex:pageBlockSection>
</apex:pageblock>
<apex:pageblock <u><b>id="pbOpp"</b></u>>
<apex:pageBlockSection rendered="{!IF(OppList.size >0,true,false)}" id="pbsOpp">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block" id="panelOpp">
<apex:pageblocktable value="{!OppList}" var="Opp" onRowClick="highlightOpp(this)">
<apex:column headervalue="Name">
<apex:outputfield value="{!Opp.Name}"/>{!Opp.Id}
<apex:actionSupport event="onclick" action="{!fetchOppDetail}" <u><b>rerender="pbOppD"</b></u>>
<apex:param assignTo="{!SelectedOppId}" value="{!Opp.Id}" name="SelectedOppId"/>
</apex:actionSupport>
</apex:column>
<apex:column headervalue="Amount">
<apex:outputfield value="{!Opp.Amount}"/>
</apex:column>
</apex:pageblocktable>
</apex:outputpanel>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IF(OppList.size <1,true,false)}">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block">
Choose an account.
</apex:outputpanel>
</apex:pageBlockSection>
</apex:pageblock>
<apex:pageblock <u><b>id="pbOppD"</b></u> mode="inlineEdit">
<apex:pageBlockButtons location="top">
<apex:commandButton action="{!SaveInlineChanges}" value="Save" id="saveButton"/>
<apex:commandButton action="{!fetchOppDetail}" value="Cancel" id="cancelButton"/>
</apex:pageBlockButtons>
<apex:pageBlockSection rendered="{!IF(OppDetail.size >0,true,false)}" id="pbsOppD">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block" id="panelOppD">
<apex:pageblocktable value="{!OppDetail}" var="OppD">
<apex:column headervalue="Name">
<apex:outputfield value="{!OppD.Name}">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputfield>
</apex:column>
<apex:column headervalue="Amount">
<apex:outputfield value="{!OppD.Amount}" />
</apex:column>
</apex:pageblocktable>
</apex:outputpanel>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IF(OppDetail.size <1,true,false)}">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block">
Chosse an opportunity.
</apex:outputpanel>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
Thanks,
Sascha
I suspect that the problem is that you have some misplaced html in you actionSupport definition. Change:
<apex:actionSupport event="onchange" action="{!fetchAccounts}" <u><b>rerender="pbAcc, pbOpp, pbOppD"</b></u>/>
To:
<apex:actionSupport event="onchange" action="{!fetchAccounts}" rerender="pbAcc, pbOpp, pbOppD"/>
(This applies to the other actionSupport elements further down the page also)

Resources