I have noticed that Umbraco comes out of the box, or at least the Creative Website Startr Kit comes out of the box, with a <form> surrounding everything in the Master template. In the case of the Search form, this And if you remove the form, the applciation breaks. The problem this presents is multiple forms on one page. I have my Search form at the top, which is Nested within this outer form, and if there are no other forms on the page, it works fine. But on the Contact Us page, where I am pulling in an Umbraco Countour form for teh Contact form, when I do a Search, it submits the Contact form instead of the Search form.
I was not entirely accurate on this post. It seems that this outer form in the Master template BECOMES whatever form I pull in from a Macro. So there is always only one form. But if I want Search AND Contact Us, then I obviously nede two. How to achieve?
The general rule to remember is that you can only have one server-side form (runat=server) on a page, but providing you don't nest your forms you can have as many HTML forms as you like along with this. So the common way to do what you want is to remove the form with the 'runat=server' from your master template and only include it around the item which requires it (Contour forms in your case I think), then use a standard HTML form for things like your search input box which don't require to run on the server side.
It does, I mean I am getting Somewhere. I get what you're saying, and I tried this; but according to the error I am getting when loading the Contact Us form page, the Search form cannot be a standard htm,HTML form:
Control 'ctl00_ctl00_ctl00_ContentPlaceHolderDefault_SearchBox_3_searchText' of type 'TextBox' must be placed inside a form tag with runat=server.
I now have two forms, neither of which are nested. BOTH the Search form AND the Contour form are telling me they need to have the runat=server, so I don't know what to Do here. How can the CWS_Search macro be a standard HTML form?
I've not used that particular search package, but I know for certain that Doug Drobar's XSLTSearch package works from a standard HTML form post/get, so perhaps try that one (I know it's an alternative rather than a solution, but it should work). I've used XSLTSearch and Contour together on a couple of sites and they live in total harmony :)
Darn it. Have already done so much work formatting the form and results and all that. Well, I just tried that XSLTSearch Macro in my template, and yes, it does appear not to cause a conflict; I was just confused by some of the parameters it takes. For example, what is the "Source" parameter? Meaning the node below which you would like the search to be performed?
Hi, I too have this problem. I have a custom google map search that is runat=server and I want the end user to be able to put Contour forms in rich text editors on pages. Is there no other way around this? If not, then I may have to ask for a refund on Contour.
I'm now trying to use the XSLT Search macro. The form shows up fine (input/submit), but instead of results I'm getting a Page Cannot Be Displayed error. Any idea what I'm doing wrong?
may want to look into using jQuery or simple javascript to post any nested forms that you have in your root form (presumably in one of your templates). THis is typically the best approach since we all have to conform to the one form per page issue. If you want some examples, just let us know.
In .Net 2 and above, you can assign forms and their validation controls to 'groups' to allow you to have multiple groups of controls on one form on a page that don't interfere with each other. So while you have only one form with runat="server" on the page, the grouping allows you to effectively separate the separate groups of form controls into logical sub-forms.
Unfortunately, Contour doesn't assign it's controls to a validation group (hopefully this will be in a future release), so any contour form on the same page as another form (such as a search) will cause the two forms to fire each other's validation controls.
To get round this, assign a 'validationgroup' property to the form button controls and validation controls for each of the forms that you are creating. For example:
Clicking the btnTest button would only fire the validation events for the validation controls in the same group as itself, everything else will be ignored, allowing you to have multiple forms within the same asp.net form.
I'm also facing this nested html form issue. Please let me know if anyone having solution on it.
My Problem statement:
I'm working on web application which is developed in Umbraco CMS
.Net framework. and I want to add one html form in existing umbraco
page. When I add my html form and run the application that time
umbraco add one parent form to my form. And when I try to post my form
through JavaScript it gives me error "Uncaught TypeError: Cannot read
property 'submit' of null".*
multiple forms on same page a problem
Hi,
I have noticed that Umbraco comes out of the box, or at least the Creative Website Startr Kit comes out of the box, with a <form> surrounding everything in the Master template. In the case of the Search form, this And if you remove the form, the applciation breaks. The problem this presents is multiple forms on one page. I have my Search form at the top, which is Nested within this outer form, and if there are no other forms on the page, it works fine. But on the Contact Us page, where I am pulling in an Umbraco Countour form for teh Contact form, when I do a Search, it submits the Contact form instead of the Search form.
How can I avoid this? Anyone else had this issue?
Thanks,
Garrett
I was not entirely accurate on this post. It seems that this outer form in the Master template BECOMES whatever form I pull in from a Macro. So there is always only one form. But if I want Search AND Contact Us, then I obviously nede two. How to achieve?
The general rule to remember is that you can only have one server-side form (runat=server) on a page, but providing you don't nest your forms you can have as many HTML forms as you like along with this. So the common way to do what you want is to remove the form with the 'runat=server' from your master template and only include it around the item which requires it (Contour forms in your case I think), then use a standard HTML form for things like your search input box which don't require to run on the server side.
Hope this helps...
It does, I mean I am getting Somewhere. I get what you're saying, and I tried this; but according to the error I am getting when loading the Contact Us form page, the Search form cannot be a standard htm,HTML form:
Control
'ctl00_ctl00_ctl00_ContentPlaceHolderDefault_SearchBox_3_searchText' of
type 'TextBox' must be placed inside a form tag with runat=server.
I now have two forms, neither of which are nested. BOTH the Search form AND the Contour form are telling me they need to have the runat=server, so I don't know what to Do here. How can the CWS_Search macro be a standard HTML form?
Continued thanks,
Garrett
Hi Garrett,
I've not used that particular search package, but I know for certain that Doug Drobar's XSLTSearch package works from a standard HTML form post/get, so perhaps try that one (I know it's an alternative rather than a solution, but it should work). I've used XSLTSearch and Contour together on a couple of sites and they live in total harmony :)
Darn it. Have already done so much work formatting the form and results and all that. Well, I just tried that XSLTSearch Macro in my template, and yes, it does appear not to cause a conflict; I was just confused by some of the parameters it takes. For example, what is the "Source" parameter? Meaning the node below which you would like the search to be performed?
Hey-- thanks again.
//Garrett
Hi, I too have this problem. I have a custom google map search that is runat=server and I want the end user to be able to put Contour forms in rich text editors on pages. Is there no other way around this? If not, then I may have to ask for a refund on Contour.
Hi Dan,
I'm now trying to use the XSLT Search macro. The form shows up fine (input/submit), but instead of results I'm getting a Page Cannot Be Displayed error. Any idea what I'm doing wrong?
Form HTML output:
Macro in template:
Thanks,
Garrett
Garrett,
may want to look into using jQuery or simple javascript to post any nested forms that you have in your root form (presumably in one of your templates). THis is typically the best approach since we all have to conform to the one form per page issue. If you want some examples, just let us know.
Thanks,
Nik
Hi Nik,
I have the same problem when I use Contour. I would like to see some example's if that is possible.
Maybe you know if it is possible to change the submit in Contour, so I only have to do this once.
Thanx,
Bas
Hiya,
In .Net 2 and above, you can assign forms and their validation controls to 'groups' to allow you to have multiple groups of controls on one form on a page that don't interfere with each other. So while you have only one form with runat="server" on the page, the grouping allows you to effectively separate the separate groups of form controls into logical sub-forms.
Unfortunately, Contour doesn't assign it's controls to a validation group (hopefully this will be in a future release), so any contour form on the same page as another form (such as a search) will cause the two forms to fire each other's validation controls.
To get round this, assign a 'validationgroup' property to the form button controls and validation controls for each of the forms that you are creating. For example:
<asp:button id="btnTest" runat="server" validationgroup="search" />
<asp:requiredfieldvalidator id="reqTest" runat="server" validationgroup="search" />
Clicking the btnTest button would only fire the validation events for the validation controls in the same group as itself, everything else will be ignored, allowing you to have multiple forms within the same asp.net form.
Hope that makes sense/is useful.
:)
I'm also facing this nested html form issue. Please let me know if anyone having solution on it.
My Problem statement:
See below code.
is working on a reply...