Link to home
Start Free TrialLog in
Avatar of brettr
brettr

asked on

Master page and HTML FORM tag?

How can I use an HTML FORM tag on a content page that uses a Master page?  The HTML FORM is now inside the Master page serverside FORM.  I need to use the HTML FORM on a few pages.

Specifically: I have one page with multiple PayPal "Add to cart" images.  Each image is inside of a FORM.  This is code that comes from PayPal.  So how can I do that with one FORM tag (Master page's FORM)?  

The page has an "Add to cart" for each different product.  Each product one uses a different URL.

Thanks,
Brett
Avatar of stengelj
stengelj
Flag of United States of America image

You can add this to your page directive on every page that you need to add an HTML FORM: EnableEventValidation="false"

Or,

You can apply this setting to all of your web pages by  adding this to the system.web section of your web.config file:
<pages validateRequest="false" enableEventValidation="false" />

Before you do this, make sure you understand and are okay with impact this could have on your security.  

See: http://msdn2.microsoft.com/en-us/library/system.web.ui.page.enableeventvalidation.aspx

That should work.

Avatar of brettr
brettr

ASKER

Thanks.  This is close to working.  However, the first FORM doesn't work.  It still references the current URL, which just references the current page.  But all FORMs after on that same page are fine.  So I put an empty FORM first:

<form></form>

and I'm good to go.  Any idea why that is?
ASKER CERTIFIED SOLUTION
Avatar of stengelj
stengelj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brettr

ASKER

I'll use the dummy <form> tags on specific pages, since I still use the master's <form> tag in some cases.

Thanks.
You should be able to have the dummy <form>on the master and still be able to use the "official" master's <form> tag.  The runat="server" should trump the dummy <form> tag for any of your server-side stuff, but I can understand wanting to keep the workarounds on their respective pages.

Thanks for the points and good luck with your project!
Avatar of brettr

ASKER

You're welcome.  I've put up another post you might be interested in: https://www.experts-exchange.com/questions/22077883/Should-this-use-a-session.html.