I have created a Sharepoint list definition, and an instance of that definition. In the instance I need to store some HTML as the value of a field in my list instance. I know I can do this through the UI, but I need this list created on deployment. When I wrap my HTML value in CDATA tags, the item is simply not created. I get a deployment error if I Just have my HTML inline with my XML.
Elements.xml:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="ListName"
OnQuickLaunch="TRUE"
TemplateType="10051"
Url="Lists/ListName"
Description="List Description">
<Data>
<Rows>
<Row>
<Field Name="Title">My Title</Field>
<Field Name="Value">
<p>Some HTML HERE</p>
<table border="1"; cellpadding="10";>
<tr style="font-family:Arial; font-size:10pt;">
<th>header1</th>
<th> ... </th>
</tr>
<tr style="font-family:Arial; font-size:8pt;">
<td>Vaue1</td>
<td> ... </td>
</tr>
</table>
</Field>
</Row>
</Rows>
</Data>
</ListInstance>
</Elements>
Any help would be appreciated.
You need to HTML encode the value:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="ListName"
OnQuickLaunch="TRUE"
TemplateType="10051"
Url="Lists/ListName"
Description="List Description">
<Data>
<Rows>
<Row>
<Field Name="Title">My Title</Field>
<Field Name="Value">
<p>Some HTML HERE</p>
<table border="1"; cellpadding="10";>
<tr style="font-family:Arial; font-size:10pt;">
<th>header1</th>
<th> ... </th>
</tr>
<tr style="font-family:Arial; font-size:8pt;">
<td>Vaue1</td>
<td> ... </td>
</tr>
</table>
</Field>
</Row>
</Rows>
</Data>
</ListInstance>
</Elements>
Related
Trying to select and click multiple checkboxes on a page. they don't have a class, ID or names that match. All they have in common is their input type (checkbox). I'm able to select individual checkboxes using XPATH but its not practical as there's at least 100 checkboxes on the page.
Here's a section of the HTML. I've been testing this code on an off-line version of the site.
<body>
<tbody>
<tr>
<td class="borderBot"><b>Activity</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="33%">
<input type="checkbox" name="competency1Activity" value="1" />
Plan (ie Interpreted diag etc)
</td>
<td width="33%">
<input type="checkbox" name="competency1Activity" value="2" />
Carry Out (ie conducted work)
</td>
<td width="33%">
<input type="checkbox" name="competency1Activity" value="4" />
Complete (ie Compliance etc)
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderBot"><b>Supervision</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="33%">
<input
type="checkbox"
name="competency1Supervision"
value="1"
/>
Direct
</td>
<td width="33%">
<input
type="checkbox"
name="competency1Supervision"
value="2"
/>
General
</td>
<td width="33%">
<input
type="checkbox"
name="competency1Supervision"
value="4"
/>
Broad
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderBot"><b>Support</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="33%">
<input type="checkbox" name="competency1Support" value="1" />
Constant
</td>
<td width="33%">
<input type="checkbox" name="competency1Support" value="2" />
Intermittent
</td>
<td width="33%">
<input type="checkbox" name="competency1Support" value="4" />
Minimal
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderBot"><b>Materials</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="1" />
Insulation failure
</td>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="2" />
Incorrect connections
</td>
</tr>
<tr>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="4" />
Circuits-wiring; eg. open short
</td>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="8" />
Unsafe condition
</td>
</tr>
<tr>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="16"
/>
Apparatus/component failure
</td>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="32"
/>
Related mechanical failure
</td>
</tr>
<tr>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="64"
/>
Read/interpret drawings/plans
</td>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="128"
/>
Other elec app and circuit faults
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<input
type="hidden"
id="competency1ExtendedCount"
name="competency1ExtendedCount"
value="8"
/>
</tbody>
</body>
Try 1 - this selects and clicks the first checkbox but none of the others
checkboxes = driver.find_element(By.CSS_SELECTOR, "input[type='checkbox']").click()
Try 2 - Thought this would work but I cant get the syntax right
checkboxes = driver.find_element(By.CSS_SELECTOR, "input[type='checkbox']")
for checkbox in checkboxes:
checkboxes.click()
time.sleep(.3)
Try 3 - able to select first checkbox (of 3) with this name
checkboxes = driver.find_element("name", "competency1Ativity").click()
find_element() will return only the first matching element, where as you need to identify all of them. So you need to use find_elements() method.
Solution
You can identify all the checkbox and store the elements within a list and then click on them one by one using either of the following locator strategies:
Using CSS_SELECTOR:
from selenium.webdriver.common.by import By
checkboxes = driver.find_elements(By.CSS_SELECTOR, "td input[type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
Using XPATH:
from selenium.webdriver.common.by import By
checkboxes = driver.find_elements(By.XPATH, "//td//input[#type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
Your option 2 was nearly correct, however it should have been find_elements() not find_element()
Since find_element() just returns an webelement where as find_elements() returns list of elements.
code:
checkboxes = driver.find_elements(By.CSS_SELECTOR, "input[type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
time.sleep(0.5)
I Have a Attribute that I want to display, but I only want to display the last portion of it indicated by an "-". I am using substring-after to do this but this only works if there is one charactor. There are occasions where there might be one and some where there is two. I have seen some recursive templates for this but I have not seen them in a For-each Loop like I have it here and I am not sure where I would put everything in my XSL document.
Here is my XML document:
<?xml version="1.0" encoding="UTF-8"?>
<JobList>
<Job T.number="28" />
<Job T.identifier="10mm Drill" />
<Job oper.jobName="2: T28-Contour Milling - Grind me back" />
<Job T.number="3" />
<Job T.identifier="9mm Drill" />
<Job oper.jobName="3: T3 Contour Milling" />
</JobList>
Here is my XSL Document. I am using XSL 1.0. The result I am looking for is I want this to be displayed as "10mm Drill - Grind me back" not "10mm Drill-Contour Milling - Grind me back" which is what I am getting now using the substring-after function or something with the same result.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" encoding="UTF-8" method="xml" />
<xsl:param name="REPORT">joblist</xsl:param>
<xsl:param name="LOCALE">en-GB</xsl:param>
<xsl:param name="FORMAT">html</xsl:param>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Tool Report</title>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="JobList">
<div style="font-size:;">
<table width="100%" style="margin-bottom:50px;font:bold 10px arial;">
<thead>
<tr>
<th style="text-align:center;font-family:Arial;font-size:13;font:bold 7px arial;">
<xsl:value-of select="#month">
</xsl:value-of>
<span>.</span>
<xsl:value-of select="#day">
</xsl:value-of>
<span>.</span>
<xsl:value-of select="#year">
</xsl:value-of>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center;font:normal 7px arial;font-size:12px;">
<xsl:value-of select="//Job[position()=1]/#cfg.JOBLISTNAME" />
<span>
</span>
<span>
</span>
</td>
</tr>
</tbody>
<table width="100%" border="1" style="margin-bottom:50px;font:13px arial;">
<thead style="font:19;">
<tr style="font-size:19;">
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
<td style="text-align:center;font-weight:bold;font-size:19;">
</td>
</tr>
</thead>
<tbody style="font-size:19;">
<xsl:for-each select="//Job[not(#T.number=preceding::Job/#T.number)]">
<tr style="font-size:19;">
<td style="font-size:19;">
<xsl:value-of select="#T.number" />
</td>
<td>
</td>
<td style="font-size:19;">
<xsl:value-of select="#T.identifier" />
<xsl:choose>
<xsl:when test="contains(#T.toolComment3, 'GRIND') or contains(#T.toolComment3, 'Grind')">
<xsl:value-of select="#T.toolComment3" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="contains(#T.comment2, 'GRIND') or contains(#T.comment2, 'Grind')">
<xsl:value-of select="#T.comment2" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="contains(#oper.jobName, 'GRIND') or contains(#oper.jobName, 'Grind')">
<xsl:value-of select="substring-after(#oper.jobName, '-')" />
</xsl:when>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
Use a named recursive template to get the last token of the text string.
<xsl:template name="last-token">
<xsl:param name="text"/>
<xsl:param name="delimiter" select="'-'"/>
<xsl:choose>
<xsl:when test="contains($text, $delimiter)">
<!-- recursive call -->
<xsl:call-template name="last-token">
<xsl:with-param name="text" select="substring-after($text, $delimiter)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Example of call: http://xsltransform.net/bFWR5Ew
I am trying to create a qweb report for Odoo 11 but without any success. 0 byte pdf I am getting, I edit the report to qweb-html and then only white page. Please help me to solve the issue. Below is my code. I am a beginner and trying to create this report after reading different posts and different modules.
Below is my code in 4 seprate files.
1st file
from odoo import models, fields, api
class TrueReportFields(models.TransientModel):
_name = 'true.report'
#api.multi
def print_true_report(self):
sales = self.env['sale.order'].sudo().search(
[('state', 'in', ('sale', 'done'))])
total_sale = total_cost = 0
for sale in sales:
total_sale += sale.amount_total
for lines in sale.order_line:
total_cost += lines.product_id.standard_price * lines.product_uom_qty
purchases = self.env['purchase.order'].sudo().search(
[('state', 'not in', ('draft', 'canceled'))])
total_purchase = 0
for purchase in purchases:
total_purchase += purchase.amount_total
pos_sales = self.env['pos.order'].sudo().search(
[('state', 'not in', ['cancel', 'draft'])])
total_pos_sale = total_pos_cost = 0
for pos in pos_sales:
total_pos_sale += pos.amount_total
for posl in pos.lines:
total_pos_cost += posl.product_id.standard_price * posl.qty
datas = {
'ids': self,
'model': 'true.report',
'total_sale': total_sale,
'total_cost': total_cost,
'total_purchase': total_purchase,
'total_pos_sale': total_pos_sale,
'total_pos_cost': total_pos_cost
}
return self.env.ref('true_report.action_true_report').report_action(self, data=datas)
2nd file
from odoo import api, models
class TrueReport(models.AbstractModel):
_name = 'report.true_report.report_details'
#api.model
def get_report_values(self, docids, data=None):
return {
'doc_ids': data.get('ids'),
'doc_model': data.get('model'),
'total_sale': data['total_sale'],
'total_cost': data['total_cost'],
'total_purchase': data['total_purchase'],
'total_pos_sale': data['total_pos_sale'],
'total_pos_cost': data['total_pos_cost']
}
xml views
<odoo>
<data>
<record id="view_true_report" model="ir.ui.view">
<field name="name">product.detail.form</field>
<field name="model">true.report</field>
<field name="arch" type="xml">
<form string="True Details">
<!--<group>
<group>
<field name="start_date"/>
</group>
<group>
<field name="end_date"/>
</group>
</group>-->
<footer>
<button string='Print' name="print_true_report" type="object" default_focus="1"
class="oe_highlight"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="open_true_report_action" model="ir.actions.act_window">
<field name="name">Top Sold Products</field>
<field name="res_model">true.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="view_true_report"/>
</record>
<menuitem
id="menu_true_report"
name="True Report"
parent="sale.menu_sale_report"
sequence="4"
action="true_report.open_true_report_action"/>
<report
id="action_true_report"
string="True PDF Report"
model="true.report"
report_type="qweb-pdf"
file="true_report.report_details"
name="true_report.report_details"
/>
</data>
</odoo>
xml templates
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_details_documents">
<t t-call="web.html_container">
<t t-set="o" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
<!--<t t-foreach="docs" t-as="o">-->
<!--<t t-foreach="docs" t-as="o">-->
<t t-call="web.external_layout">
<div class="page">
<div class="row">
<div class="oe_structure"/>
<div style="text-align: center;">
<span style="font-size: 25px;">True Report Details</span>
</div>
<!--<div class="row mt32 mb32">
<div class="col-xs-4">
<p>
<t>
<strong>From Date :</strong>
<span t-esc="o.start_date"/>
<br/>
</t>
<t>
<strong>To Date :</strong>
<span t-esc="o.end_date"/>
</t>
</p>
</div>
</div>-->
<table class="table table-condensed">
<thead>
<tr>
<th>Total Sales</th>
<th class="text-right">Total Cost</th>
<th>Total Purchase</th>
<th>Pos Sale</th>
<th>Pos Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span t-esc="o.total_sale"/>
</td>
<!-- <td class="text-right" style="white-space: text-nowrap;">
<span t-esc="o.total_cost"/>
</td>
<td>
<span t-esc="o.total_purchase"/>
</td>
<td>
<span t-esc="o.total_pos_sale"/>
</td>
<td>
<span t-esc="o.total_pos_cost"/>
</td>-->
</tr>
</tbody>
</table>
</div>
</div>
</t>
<!--</t>-->
</t>
</template>
<template id="report_details">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="true_report.report_details_documents" t-lang="o.company_id.partner_id.lang"/>
</t>
</t>
</template>
</odoo>
Please help me to solve the issue. I will be a great help.
Thanks in advance.
you can try
<t t-call="web.external_layout"> instead of <t t-call="web.html_container">
I have document Library where the ColumnName is Name and the data is hyperlinked to Documents.
I want to access this through xslt.
My xsl code is given below:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method='html' indent='yes'/>
<xsl:template match='dsQueryResponse'>
<table cellpadding="10" cellspacing="0" border="1" style="padding:25px;">
<tr>
<td colspan='2'>
<b style="font-size:25px;">NewsLetter List</b>
</td>
</tr>
<xsl:apply-templates select='Rows/Row'/>
</table>
</xsl:template>
<xsl:template match='Row'>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<b>
<img src="../PublishingImages/newsletter_icon.png" width="20px" height="20px"></img>
</b>
</td>
<td>
<xsl:value-of select="#Name"/>
</td>
</tr>
</table>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
Assuming the source XML contains the same attributes that are available by default, could you try replacing this:
<td>
<xsl:value-of select="#Name"/>
</td>
With this:
<td>
<a href="{#FileRef}">
<xsl:value-of select="#Name"/>
</a>
</td>
SharePoint ChangeContentType DropDown
I have attached an application page to the custom document based content type as its edit form.
That content type is being used in a document library which has more than one content type attached to it.
SharePoint form field controls render the respective fields correctly. Change content type control lists all the content types related to the lists in a dropdown as well. But when I change the selection, means when I select different content type, the form does not show the set of fields for the selected content type rather it stays as it is.
Code:
<%# Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%# Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%# Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%# Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%# Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%# Import Namespace="Microsoft.SharePoint" %>
<%# Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="ApplicationPage1.aspx.cs" Inherits="DMS_POC.Layouts.DMS_POC.ApplicationPage1" DynamicMasterPageFile="~masterurl/default.master" %>
<%# Register TagPrefix="wssuc" TagName="ToolBar" src="../../../_controltemplates/15/ToolBar.ascx" %>
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<table>
<tr>
<td>
<span id='part1'>
<SharePoint:InformationBar ID="InformationBar1" runat="server" />
<div id="listFormToolBarTop">
<wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbltop" RightButtonSeparator=" " runat="server">
<template_rightbuttons>
<SharePoint:NextPageButton ID="NextPageButton1" runat="server"/>
<SharePoint:SaveButton ID="SaveButton1" runat="server"/>
<SharePoint:GoBackButton ID="GoBackButton1" runat="server"/>
</template_rightbuttons>
</wssuc:ToolBar>
</div>
<SharePoint:ItemValidationFailedMessage ID="ItemValidationFailedMessage1" runat="server" />
<table class="ms-formtable" style="margin-top: 8px;" border="0" cellpadding="0" cellspacing="0" width="100%">
<SharePoint:ChangeContentType ID="ChangeContentType1" runat="server" />
<SharePoint:FolderFormFields ID="FolderFormFields1" runat="server" />
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_ProposalNumber" runat="server" FieldName="ProposalNo" />
</td>
<td>
<SharePoint:FormField ID="field_ProposalNumber" runat="server" FieldName="ProposalNo"
ControlMode="Display" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_CustName" runat="server" FieldName="CustomerName" />
</td>
<td>
<SharePoint:FormField ID="field_CustName" runat="server" FieldName="CustomerName"
ControlMode="Edit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_ProposalType" runat="server" FieldName="ProposalType" />
</td>
<td>
<SharePoint:FormField ID="field_ProposalType" runat="server" FieldName="ProposalType"
ControlMode="Edit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_RevertBy" runat="server" FieldName="RevertBy" />
</td>
<td>
<SharePoint:FormField ID="field_RevertBy" runat="server" FieldName="RevertBy"
ControlMode="Edit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td style="vertical-align:top">
<SharePoint:FieldLabel ID="lbl_Details" runat="server" FieldName="Details" />
</td>
<td style="vertical-align:top">
<SharePoint:FormField ID="field_Details" runat="server" FieldName="Details"
ControlMode="Edit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_SignRequired" runat="server" FieldName="DigitalSignatureRequired" />
</td>
<td>
<SharePoint:FormField ID="field_SignRequired" runat="server" FieldName="DigitalSignatureRequired"
ControlMode="Edit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_Amount" runat="server" FieldName="Amount" />
</td>
<td>
<SharePoint:FormField ID="field_Amount" runat="server" FieldName="Amount"
ControlMode="Edit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td>
<SharePoint:FieldLabel ID="lbl_Final" runat="server" FieldName="Final" />
</td>
<td>
<SharePoint:FormField ID="field_Final" runat="server" FieldName="Final"
ControlMode="Edit" />
</td>
</tr>
<SharePoint:ApprovalStatus ID="ApprovalStatus1" runat="server" />
<SharePoint:FormComponent ID="FormComponent1" TemplateName="AttachmentRows" ComponentRequiresPostback="false" runat="server" />
</table>
<table cellpadding="0" cellspacing="0" width="100%" style="padding-top: 7px">
<tr>
<td width="100%">
<SharePoint:ItemHiddenVersion ID="ItemHiddenVersion1" runat="server" />
<SharePoint:ParentInformationField ID="ParentInformationField1" runat="server" />
<SharePoint:InitContentType ID="InitContentType1" runat="server" />
<wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl" RightButtonSeparator=" " runat="server">
<template_buttons>
<SharePoint:CreatedModifiedInfo ID="CreatedModifiedInfo1" runat="server"/>
</template_buttons>
<template_rightbuttons>
<SharePoint:SaveButton ID="SaveButton2" runat="server"/>
<SharePoint:GoBackButton ID="GoBackButton2" runat="server"/>
</template_rightbuttons>
</wssuc:ToolBar>
</td>
</tr>
</table>
</span>
</td>
<td valign="top">
<SharePoint:DelegateControl ID="DelegateControl1" runat="server" ControlId="RelatedItemsPlaceHolder" />
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>
This is an old question but got here while looking for something else.
In case you never found the solution or someone else ends up here here is what you need to do
Add the following in your aspx:
<tr><SharePoint:ListFieldIterator runat="server" ID="ListFieldIterator1" ControlMode="Edit" ExcludeFields="FileLeafRef"/></tr>
This will allow the ChangeContentType control to refresh the fields based on content types. You also don't need all those hard coded form fields as the purpose of the ListFieldIterator is to render the form with the correct controls for you.
Your next problem will probably be to set the values of each control assuming that is what you want to do. For each control type you have to look at the Controls and look for controls like TextBox or DropDownList, etc. Most of the time the control will be deep inside as in something like ((TextBox)control.Controls[1].Controls[0].Control[2]).Text
Not the most elegant way but this is all I could find to make it work.
If you don't need to map values then the first part of my answer is all you need and should be easy to do.
Good luck!