Quick question about usercontrols and asp.net validation controls
Stumbled across something i cant really see where the problem is.
So i created a dead simple contact form (hardcoded, single purpose only), that takes a few inputs from the user and sends an email. The fields are validated with plain old "RequiredFieldValidator" and others.
When adding the usercontrol to a standard webform aspx page in my visual studio project, everything works fine, emails works, and validators work. I have taken great care to be sure everything is wired up correctly, and with proper validation groups etc.
I then added the usercontrol to my umbraco site, the control is displayed fine but the validation does not fire and isnt shown at all.
I dont think its necessary to show any code as there isnt much to show, its all fairly simple and straight forward.
Ok got around testing it again. If i type in the correct data and submit it, it does send an email exactly like it should (this is tested in the live production environment).
If i do it wrong, nothing gets sent. So it seems like the validation works, but it doesnt display anything (the browser also scrolls to the top whenever i click the submit button but it doesnt look like a postback because there is a video running on the same page and it doesnt reload when it happens).
I searched around the forums some more, and seems i am not the only one with this problem. The thing is, there is not a solution in any of the forum posts, and those that resembled one, did not work.
yeah it has been a while but i found the culprit, sort of. Just writing it here so it will maybe help anyone who stumbles by from google and what not.
Anyway, the site i was working on, where the asp.net validation didnt work, was because of modernizr. The website is built on the Foundation framework by Zurb, and they include a modernizr script, which is somehow blocking the asp.net validators from being displayed. After i commented out the script on the page where the usercontrol was being used, everything worked fine.
So what exactly is causing the problem, i do not know, but its a start.
Quick question about usercontrols and asp.net validation controls
Stumbled across something i cant really see where the problem is.
So i created a dead simple contact form (hardcoded, single purpose only), that takes a few inputs from the user and sends an email. The fields are validated with plain old "RequiredFieldValidator" and others.
When adding the usercontrol to a standard webform aspx page in my visual studio project, everything works fine, emails works, and validators work. I have taken great care to be sure everything is wired up correctly, and with proper validation groups etc.
I then added the usercontrol to my umbraco site, the control is displayed fine but the validation does not fire and isnt shown at all.
I dont think its necessary to show any code as there isnt much to show, its all fairly simple and straight forward.
So anyone stumbled across the same problems?
Hi,
Is the validation not firing but the email is sending, or is the button click doing nothing at all?
If it's not doing anything, make sure you are wrapping the usercontrol in a <form runat="server"> in your template.
-Tom
Thank you for your reply.
Ok got around testing it again. If i type in the correct data and submit it, it does send an email exactly like it should (this is tested in the live production environment).
If i do it wrong, nothing gets sent. So it seems like the validation works, but it doesnt display anything (the browser also scrolls to the top whenever i click the submit button but it doesnt look like a postback because there is a video running on the same page and it doesnt reload when it happens).
I searched around the forums some more, and seems i am not the only one with this problem. The thing is, there is not a solution in any of the forum posts, and those that resembled one, did not work.
This is just so odd.
yeah it has been a while but i found the culprit, sort of. Just writing it here so it will maybe help anyone who stumbles by from google and what not.
Anyway, the site i was working on, where the asp.net validation didnt work, was because of modernizr. The website is built on the Foundation framework by Zurb, and they include a modernizr script, which is somehow blocking the asp.net validators from being displayed. After i commented out the script on the page where the usercontrol was being used, everything worked fine.
So what exactly is causing the problem, i do not know, but its a start.
If I could add a 1000 high fives I would, thanks a lot! Been searching on this one for hours.
is working on a reply...