runat=“server” and multiple forms on a vb.net page











up vote
0
down vote

favorite












I have a page that displays employee information for a company. The list is split into 3 groups. Each group has an add button and an edit button. The buttons call the respective subform in a modal window.



Since the forms are built in vb.net and use ASP objects, they need the form to be wrapped in a form that has runat="server". I am unable to add the run at server directive to each of the 6 sub forms's form tags as I can only have one runat="server" per page.



To get around that, I added the directive to a form element that wraps the body of the page. Now I'm getting an error because of nested form elements. How do I get around this?



<body>
<form runat="server">

<form id="popup1">
</form>

<form id="popup2">
</form>

<form id="popup3">
</form>


<form id="popup4">
</form>


<form id="popup5">
</form>


<form id="popup6">
</form>

</form>
</body>


I read about the form elements getting a form attribute that ties the elements to a particular form as in form="form1" and so on. But I'm not sure if that will work in my case since some folks may try to use Internet Explorer which does not support the form attribute.



I'm thinking that I need to create only one modal form for my page, add all the elements for all six forms and then use logic to show/hide elements based upon which button is pressed. The problem is that the forms are rendered on the server side using asp elements and the button press is client side. I could use some javascript to handle this, but things could get messy. Additionally, the forms may get loaded with data or not depending on whether the button presses is add employee or edit employee.



Maybe I should create the 6 modal forms without using asp objects and stick to HTML objects. This negates the use of ASP's regular expression validators but I'm ok with that.










share|improve this question






















  • You can unlimited runat attributes on a page. You can only have one form element.
    – IrishChieftain
    Nov 19 at 16:24






  • 1




    That is not correct. I've been coding for years and can have multiple forms on a page as long as they are not nested. It's only when I want multiple forms on a page to have the runat="server" attribute that I run into problems.
    – RCDAWebmaster
    Nov 19 at 16:43










  • Not with Web Forms without messy hacks: stackoverflow.com/questions/7544454/… In the Web Forms world, a form tag with no runat does nothing.
    – IrishChieftain
    Nov 19 at 17:02












  • Ah yeah. A form containing asp elements needs the runat="server" and you can only have one per page. If I create the form in plain HTML, I can have as many forms as I like on a page as long as they are not nested. In that case, I will have to build the 6 forms in HTML and use javascript to validate them. That's a bit tedious because I will have to change my form elements a bit but it will work. I wish there was a better way.
    – RCDAWebmaster
    Nov 19 at 18:15












  • This is the Achilles Heel of Web Forms ;-)
    – IrishChieftain
    Nov 19 at 18:56















up vote
0
down vote

favorite












I have a page that displays employee information for a company. The list is split into 3 groups. Each group has an add button and an edit button. The buttons call the respective subform in a modal window.



Since the forms are built in vb.net and use ASP objects, they need the form to be wrapped in a form that has runat="server". I am unable to add the run at server directive to each of the 6 sub forms's form tags as I can only have one runat="server" per page.



To get around that, I added the directive to a form element that wraps the body of the page. Now I'm getting an error because of nested form elements. How do I get around this?



<body>
<form runat="server">

<form id="popup1">
</form>

<form id="popup2">
</form>

<form id="popup3">
</form>


<form id="popup4">
</form>


<form id="popup5">
</form>


<form id="popup6">
</form>

</form>
</body>


I read about the form elements getting a form attribute that ties the elements to a particular form as in form="form1" and so on. But I'm not sure if that will work in my case since some folks may try to use Internet Explorer which does not support the form attribute.



I'm thinking that I need to create only one modal form for my page, add all the elements for all six forms and then use logic to show/hide elements based upon which button is pressed. The problem is that the forms are rendered on the server side using asp elements and the button press is client side. I could use some javascript to handle this, but things could get messy. Additionally, the forms may get loaded with data or not depending on whether the button presses is add employee or edit employee.



Maybe I should create the 6 modal forms without using asp objects and stick to HTML objects. This negates the use of ASP's regular expression validators but I'm ok with that.










share|improve this question






















  • You can unlimited runat attributes on a page. You can only have one form element.
    – IrishChieftain
    Nov 19 at 16:24






  • 1




    That is not correct. I've been coding for years and can have multiple forms on a page as long as they are not nested. It's only when I want multiple forms on a page to have the runat="server" attribute that I run into problems.
    – RCDAWebmaster
    Nov 19 at 16:43










  • Not with Web Forms without messy hacks: stackoverflow.com/questions/7544454/… In the Web Forms world, a form tag with no runat does nothing.
    – IrishChieftain
    Nov 19 at 17:02












  • Ah yeah. A form containing asp elements needs the runat="server" and you can only have one per page. If I create the form in plain HTML, I can have as many forms as I like on a page as long as they are not nested. In that case, I will have to build the 6 forms in HTML and use javascript to validate them. That's a bit tedious because I will have to change my form elements a bit but it will work. I wish there was a better way.
    – RCDAWebmaster
    Nov 19 at 18:15












  • This is the Achilles Heel of Web Forms ;-)
    – IrishChieftain
    Nov 19 at 18:56













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a page that displays employee information for a company. The list is split into 3 groups. Each group has an add button and an edit button. The buttons call the respective subform in a modal window.



Since the forms are built in vb.net and use ASP objects, they need the form to be wrapped in a form that has runat="server". I am unable to add the run at server directive to each of the 6 sub forms's form tags as I can only have one runat="server" per page.



To get around that, I added the directive to a form element that wraps the body of the page. Now I'm getting an error because of nested form elements. How do I get around this?



<body>
<form runat="server">

<form id="popup1">
</form>

<form id="popup2">
</form>

<form id="popup3">
</form>


<form id="popup4">
</form>


<form id="popup5">
</form>


<form id="popup6">
</form>

</form>
</body>


I read about the form elements getting a form attribute that ties the elements to a particular form as in form="form1" and so on. But I'm not sure if that will work in my case since some folks may try to use Internet Explorer which does not support the form attribute.



I'm thinking that I need to create only one modal form for my page, add all the elements for all six forms and then use logic to show/hide elements based upon which button is pressed. The problem is that the forms are rendered on the server side using asp elements and the button press is client side. I could use some javascript to handle this, but things could get messy. Additionally, the forms may get loaded with data or not depending on whether the button presses is add employee or edit employee.



Maybe I should create the 6 modal forms without using asp objects and stick to HTML objects. This negates the use of ASP's regular expression validators but I'm ok with that.










share|improve this question













I have a page that displays employee information for a company. The list is split into 3 groups. Each group has an add button and an edit button. The buttons call the respective subform in a modal window.



Since the forms are built in vb.net and use ASP objects, they need the form to be wrapped in a form that has runat="server". I am unable to add the run at server directive to each of the 6 sub forms's form tags as I can only have one runat="server" per page.



To get around that, I added the directive to a form element that wraps the body of the page. Now I'm getting an error because of nested form elements. How do I get around this?



<body>
<form runat="server">

<form id="popup1">
</form>

<form id="popup2">
</form>

<form id="popup3">
</form>


<form id="popup4">
</form>


<form id="popup5">
</form>


<form id="popup6">
</form>

</form>
</body>


I read about the form elements getting a form attribute that ties the elements to a particular form as in form="form1" and so on. But I'm not sure if that will work in my case since some folks may try to use Internet Explorer which does not support the form attribute.



I'm thinking that I need to create only one modal form for my page, add all the elements for all six forms and then use logic to show/hide elements based upon which button is pressed. The problem is that the forms are rendered on the server side using asp elements and the button press is client side. I could use some javascript to handle this, but things could get messy. Additionally, the forms may get loaded with data or not depending on whether the button presses is add employee or edit employee.



Maybe I should create the 6 modal forms without using asp objects and stick to HTML objects. This negates the use of ASP's regular expression validators but I'm ok with that.







html asp.net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 15:25









RCDAWebmaster

186




186












  • You can unlimited runat attributes on a page. You can only have one form element.
    – IrishChieftain
    Nov 19 at 16:24






  • 1




    That is not correct. I've been coding for years and can have multiple forms on a page as long as they are not nested. It's only when I want multiple forms on a page to have the runat="server" attribute that I run into problems.
    – RCDAWebmaster
    Nov 19 at 16:43










  • Not with Web Forms without messy hacks: stackoverflow.com/questions/7544454/… In the Web Forms world, a form tag with no runat does nothing.
    – IrishChieftain
    Nov 19 at 17:02












  • Ah yeah. A form containing asp elements needs the runat="server" and you can only have one per page. If I create the form in plain HTML, I can have as many forms as I like on a page as long as they are not nested. In that case, I will have to build the 6 forms in HTML and use javascript to validate them. That's a bit tedious because I will have to change my form elements a bit but it will work. I wish there was a better way.
    – RCDAWebmaster
    Nov 19 at 18:15












  • This is the Achilles Heel of Web Forms ;-)
    – IrishChieftain
    Nov 19 at 18:56


















  • You can unlimited runat attributes on a page. You can only have one form element.
    – IrishChieftain
    Nov 19 at 16:24






  • 1




    That is not correct. I've been coding for years and can have multiple forms on a page as long as they are not nested. It's only when I want multiple forms on a page to have the runat="server" attribute that I run into problems.
    – RCDAWebmaster
    Nov 19 at 16:43










  • Not with Web Forms without messy hacks: stackoverflow.com/questions/7544454/… In the Web Forms world, a form tag with no runat does nothing.
    – IrishChieftain
    Nov 19 at 17:02












  • Ah yeah. A form containing asp elements needs the runat="server" and you can only have one per page. If I create the form in plain HTML, I can have as many forms as I like on a page as long as they are not nested. In that case, I will have to build the 6 forms in HTML and use javascript to validate them. That's a bit tedious because I will have to change my form elements a bit but it will work. I wish there was a better way.
    – RCDAWebmaster
    Nov 19 at 18:15












  • This is the Achilles Heel of Web Forms ;-)
    – IrishChieftain
    Nov 19 at 18:56
















You can unlimited runat attributes on a page. You can only have one form element.
– IrishChieftain
Nov 19 at 16:24




You can unlimited runat attributes on a page. You can only have one form element.
– IrishChieftain
Nov 19 at 16:24




1




1




That is not correct. I've been coding for years and can have multiple forms on a page as long as they are not nested. It's only when I want multiple forms on a page to have the runat="server" attribute that I run into problems.
– RCDAWebmaster
Nov 19 at 16:43




That is not correct. I've been coding for years and can have multiple forms on a page as long as they are not nested. It's only when I want multiple forms on a page to have the runat="server" attribute that I run into problems.
– RCDAWebmaster
Nov 19 at 16:43












Not with Web Forms without messy hacks: stackoverflow.com/questions/7544454/… In the Web Forms world, a form tag with no runat does nothing.
– IrishChieftain
Nov 19 at 17:02






Not with Web Forms without messy hacks: stackoverflow.com/questions/7544454/… In the Web Forms world, a form tag with no runat does nothing.
– IrishChieftain
Nov 19 at 17:02














Ah yeah. A form containing asp elements needs the runat="server" and you can only have one per page. If I create the form in plain HTML, I can have as many forms as I like on a page as long as they are not nested. In that case, I will have to build the 6 forms in HTML and use javascript to validate them. That's a bit tedious because I will have to change my form elements a bit but it will work. I wish there was a better way.
– RCDAWebmaster
Nov 19 at 18:15






Ah yeah. A form containing asp elements needs the runat="server" and you can only have one per page. If I create the form in plain HTML, I can have as many forms as I like on a page as long as they are not nested. In that case, I will have to build the 6 forms in HTML and use javascript to validate them. That's a bit tedious because I will have to change my form elements a bit but it will work. I wish there was a better way.
– RCDAWebmaster
Nov 19 at 18:15














This is the Achilles Heel of Web Forms ;-)
– IrishChieftain
Nov 19 at 18:56




This is the Achilles Heel of Web Forms ;-)
– IrishChieftain
Nov 19 at 18:56

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377771%2frunat-server-and-multiple-forms-on-a-vb-net-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377771%2frunat-server-and-multiple-forms-on-a-vb-net-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?