Doc2Form - Does this still work in v4.5.2? Getting a form error on preview
I've upgraded to v4.5.2 from v4.0.4.2 and my forms built using Doc2Form aren't working.
The fields are all there in Edit mode but when i go to Preview, it gives me this error.
Also when I check the code in my template, it has changed it from
<?ASPNET_FORM> to <form id="contactForm" runat="server">
Any advice is much appreciated
Thanks, Kim
Server Error in '/' Application.
A page can have only one server-side Form tag.
Description:
An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Web.HttpException: A page
can have only one server-side Form tag.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
2. Stack Trace:
[HttpException (0x80004005): A page can have only one
server-side Form tag.]
Doc2Form should be working with 4.5.2 - If you have upgraded from a 4.0.4.2 then I'm a bit puzzled if the <?ASPNET_FORM> tag has been working for you in that version since it's a leftover from earlier version before Umbraco 4.x.x was released.
What does the template where you are using doc2form look like? Is it wrapped in a form tag itself? When working with ASP.NET web forms (which Umbraco is using until v5 is released) all of the content is wrapped in a serverside form like the on you posted <form id="contactform" runat="server">.
I'm thinking you're having two serverside forms and that is the problem. doc2form should work if you remove the "inner" serverside form.
<asp:Content ContentPlaceHolderID="submasterContentPlaceHolder" runat="server"> <div id="breadCrumb"> <umbraco:Macro runat="server" Alias="BreadCrumbNavigation" macroAlias="BreadCrumbNavigation"></umbraco:Macro> </div> <table width="900" border="0" cellpadding="0" cellspacing="0" id="contentTable_2"> <tr> <td width="200" valign="top" class="td_leftNav"><div id="sideContent"> <umbraco:Macro runat="server" Alias="SubNavigation" macroAlias="SubNavigation" showParent="1"></umbraco:Macro> </div></td> <td width="700" valign="top" height="30"><div class="heading_bg"> <h1> <umbraco:Item runat="server" field="pageName"/> </h1> </div> <div id="mainContent2"> <form id="contactForm" runat="server"> <p><a href="/media/87212/requestforipaddress_popup.jpg">Click here</a> to see example</p> <umbraco Alias="AutoFormPlusEmail" macroAlias="AutoFormPlusEmail" DocumentType="6046" TabName="form,ipaddress1,ipaddress2,ipaddress3" PageTabs="0" HideTabNames="1" ShowDescriptions="1" Text="Mandatory fields" SubmitButtonText="Submit" PreviousButtonText="Previous" NextButtonText="Next" TextOnSubmit="Thanks your request has been sent and you will soon be notified of a job number." RedirectToNode="-2" StorePropertiesInCookies="" SendEmailResponse="1" ResponseSubject="Request for IP" ResponseMessage="Fill this in to request an IP Address" ResponseEmailFieldAlias="" ResponseCopyTo="" EmailForm="1" FormSubject="Request for IP Address" FormMessage="" FormToEmailAddress="emails" FormFromEmailAddress="email"></umbraco:Macro> </form> <p><strong>This will be logged as a Sev 3 and is actioned within 3 business days, this will not be actioned if information provide is not accurate.</strong></p> </div> </div> </table> </td> </tr> </table> </asp:Content>
I do have a couple of "runat=server" calls inside my form but I don't know which one to remove and how to do it. I tried a couple of things which didnt work. I've removed the Send to email addresses for privacy reasons.
Do you also have a ASP.NET serverside form tag in your master template?
Does your master template look like this...
<body>
<form runat="server">
<!-- your HTML and stuff here -->
</form>
</body>
If so you need to remove the form tag from the templated you have shown us above. Then it should be working. There can only be ONE serverside form, which should be the one in your masterpage. That's how ASP.NET webforms works unfortunately. It can really be a pain some times.
Yes i did indeed have a <form> tag wrapped around my Submaster content, which I have now removed. So the only form tag is the one in my form template.
I can preview now which is great but when I press Submit I get this Server Error:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an
object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AutoFormPlus.AutoFormPlus.btnSubmit_Click(Object sender, EventArgs e) +5531 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Do I need to do anything else here to make this work?
I really want to still keep my forms using Doc2 Form (Autoform) (as no time to redo in Contour just yet) but I keep running into problems with my 4.5.2 upgrade.
Cheers
Kim
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.Form1
Doc2Form - Does this still work in v4.5.2? Getting a form error on preview
I've upgraded to v4.5.2 from v4.0.4.2 and my forms built using Doc2Form aren't working.
The fields are all there in Edit mode but when i go to Preview, it gives me this error.
Also when I check the code in my template, it has changed it from
<?ASPNET_FORM> to <form id="contactForm" runat="server">
Any advice is much appreciated
Thanks, Kim
Server Error in '/' Application.
A page can have only one server-side Form tag.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
2.
Stack Trace:
[HttpException (0x80004005): A page can have only one server-side Form tag.]
System.Web.UI.Page.OnFormRender() +8905736
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +36
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
System.Web.UI.Adapters.ControlAdapter.Render(HtmlTextWriter writer) +21
umbraco.presentation.urlRewriter.FormRewriterControlAdapter.Render(HtmlTextWriter writer) +61
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +8858991
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
umbraco.presentation.masterpages._default.Render(HtmlTextWriter writer) +83
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
umbraco.UmbracoDefault.Render(HtmlTextWriter output) +118
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060
Hi Kim
Doc2Form should be working with 4.5.2 - If you have upgraded from a 4.0.4.2 then I'm a bit puzzled if the <?ASPNET_FORM> tag has been working for you in that version since it's a leftover from earlier version before Umbraco 4.x.x was released.
What does the template where you are using doc2form look like? Is it wrapped in a form tag itself? When working with ASP.NET web forms (which Umbraco is using until v5 is released) all of the content is wrapped in a serverside form like the on you posted <form id="contactform" runat="server">.
I'm thinking you're having two serverside forms and that is the problem. doc2form should work if you remove the "inner" serverside form.
Hope this makes sense.
/Jan
Hi Jan
This is my entire template here:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<%@ Master Language="C#" MasterPageFile="~/masterpages/submaster.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="submasterContentPlaceHolder" runat="server">
<div id="breadCrumb">
<umbraco:Macro runat="server" Alias="BreadCrumbNavigation" macroAlias="BreadCrumbNavigation"></umbraco:Macro>
</div>
<table width="900" border="0" cellpadding="0" cellspacing="0" id="contentTable_2">
<tr>
<td width="200" valign="top" class="td_leftNav"><div id="sideContent">
<umbraco:Macro runat="server" Alias="SubNavigation" macroAlias="SubNavigation" showParent="1"></umbraco:Macro>
</div></td>
<td width="700" valign="top" height="30"><div class="heading_bg">
<h1>
<umbraco:Item runat="server" field="pageName"/>
</h1>
</div>
<div id="mainContent2">
<form id="contactForm" runat="server">
<p><a href="/media/87212/requestforipaddress_popup.jpg">Click here</a> to see example</p>
<umbraco Alias="AutoFormPlusEmail" macroAlias="AutoFormPlusEmail" DocumentType="6046" TabName="form,ipaddress1,ipaddress2,ipaddress3" PageTabs="0" HideTabNames="1" ShowDescriptions="1" Text="Mandatory fields" SubmitButtonText="Submit" PreviousButtonText="Previous" NextButtonText="Next" TextOnSubmit="Thanks your request has been sent and you will soon be notified of a job number." RedirectToNode="-2" StorePropertiesInCookies="" SendEmailResponse="1" ResponseSubject="Request for IP" ResponseMessage="Fill this in to request an IP Address" ResponseEmailFieldAlias="" ResponseCopyTo="" EmailForm="1" FormSubject="Request for IP Address" FormMessage="" FormToEmailAddress="emails" FormFromEmailAddress="email"></umbraco:Macro>
</form>
<p><strong>This will be logged as a Sev 3 and is actioned within 3 business days, this will not be actioned if information provide is not accurate.</strong></p>
</div>
</div>
</table>
</td>
</tr>
</table>
</asp:Content>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I do have a couple of "runat=server" calls inside my form but I don't know which one to remove and how to do it. I tried a couple of things which didnt work. I've removed the Send to email addresses for privacy reasons.
Thanks for your help
Kim
Do you have a form tag on your master page (looks like "submaster")? Just a guess. If so you need to remove the form tags on this template.
I am running Doc2Form on a 4.5.2 install, so I don't think that is the issue unless it's an older version of Doc2Form (I think I use 2.0).
EDIT: D'oh I just noticed that Jan already suggested this. Still though, double check your master pages.
Hi Kim
Do you also have a ASP.NET serverside form tag in your master template?
Does your master template look like this...
<body>
<form runat="server">
<!-- your HTML and stuff here -->
</form>
</body>
If so you need to remove the form tag from the templated you have shown us above. Then it should be working. There can only be ONE serverside form, which should be the one in your masterpage. That's how ASP.NET webforms works unfortunately. It can really be a pain some times.
/Jan
Hi Jan
Yes i did indeed have a <form> tag wrapped around my Submaster content, which I have now removed. So the only form tag is the one in my form template.
I can preview now which is great but when I press Submit I get this Server Error:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Do I need to do anything else here to make this work?
I really want to still keep my forms using Doc2 Form (Autoform) (as no time to redo in Contour just yet) but I keep running into problems with my 4.5.2 upgrade.
Cheers
Kim
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.Form1
I managed to get one of my doc2form forms up and running, thanks guys
But now when I click Submit i get the thank you page but it doesn't send an email to the Email to Address which is mine.
V3 used a <add key="umbracoSmtpServer" value="mail1.example" /> to send mail
What does V4 use? I see this bit in the web.config:
<mailSettings>
<smtp>
<network host="127.0.0.1" userName="username" password="password" />
</smtp>
</mailSettings>
Tried adding my mail server under network host but nothing happens...am I doing this correctly? :/
Kim
is working on a reply...