Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

form tag in an aspx

Vote:
 

Hi!

Is it "ok" to use an html form tag in an aspx file? I get strange resaults in IE8. I cant understand what it is.

<form attributes>
</form>



Thanks

    

#54530
Oct 19, 2011 15:18
Vote:
 

The word Thanks should be outside the code.

#54531
Oct 19, 2011 15:19
Vote:
 

Hi

You can only have one form tag with the runat="server" attribute on a page, but you can have more form tags outside the form tag with runat="server".

Take a look at this post: http://www.frederikvig.com/2009/06/using-multiple-forms-on-an-asp-net-web-forms-page/

Hope this helps

Frederik

#54535
Oct 19, 2011 20:31
Vote:
 

Frederik: Thank you very much. I check it out later, got so much work in between. I'll get back. Take care.

#54538
Oct 20, 2011 6:40
Vote:
 

Hi!

Ok. Hmm. My masterpage has one form tag with runat="server". Masterpage also has a contentplaceholder. On other aspx pages I have one asp content that sends to the placeholder, so to speak.

The big mystery is that if I place a form tag in any aspx file, just a plain and simple form tag (no attributes), the layout gets messed up in IE8, it works fine in Firefox and IE compatibility mode. Any idea?

#54604
Oct 24, 2011 13:57
Vote:
 

Not without seeing the page in question :). Got any link?

#54605
Oct 24, 2011 13:59
Vote:
 

it is not possible to nestle formtags. As you've experienced, your MasterPage has one gigantic form tag runat server so you can perform asp.net logic inside of it. Firefox/Chrome will perhaps render your nestled form code, but if you inspect it you'll see that firefox and chrome strips the form tags before rendering the html. If you want nestled forms you'd need to put it into an iframe as far as I know. 

#54636
Oct 25, 2011 11:29
Vote:
 

Andreas: Hi, thank you. Hmm, what about those forms that editors can do, how do thet get tackled? They work.

I have heard somewhere that an option is to not write nestled form tags, instead just write code for fields and buttons (including a submit button) and then with code make it so that it gets posted where you want. But I dont know how to do that.

#54639
Oct 25, 2011 13:03
Vote:
 

What you are referring to is Xforms, technote about it here http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-6-R2/XForms/ this will circumvent the nestled formtag problem, usually used by editors. Write forms with asp.net controllers is the correct way to go yes.

#54641
Oct 25, 2011 13:19
Vote:
 

All right, thanks. Well I didnt do an iframe but almost, same principle, just a new window, a static html page. Ok, I think I start a new thread in the future if I want to do another form then, or maybe read up on it.

But I now know I cant nest form tags, so its good to get that confirmed.

Thank you both. Sorry I didnt have time to give you a link Frederik. Here at work I had things on a development server not public, and at home I run localhost throught Visual Studio only.

#54642
Oct 25, 2011 13:25
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.