Geeks With Blogs
Mindfully <> Creative Put your mind to it

Ok, I have a signup .aspx form using masterpages and a footer usercontrol with a "Contact Us" form (and a bit more to the layout, but I'll just focus on the to main area to this "Note to Self"). I'll start with the footer since that is the source of my problem.

On the footer, I have a "Contact Us" panel form using the modalpopup AJAX toolkit control which in turn is using validations for that particular form with it's own submit button.

The masterpage, of course, "ties" the footer form to the .aspx signup form.

For the signup .aspx page, most people know to use validation in a signup form. It's a common practice anyway isn't it?

Now that you have an idea of what the form looks like (or just go to http://www.glacsy.com/signup and click on the "Contact Us" link on the bottom to see how everything looks like). I have spent 2 days on this rare occasion trying to figure out "How isn't the signup form submitting?" The form was validating just fine, if not perfect. It was the button not submitting or "working". You click it, nothing happens - no errors, no notices, nothing... So imagine the overwhelming frustration slapping me in my face at that moment. Not a great feeling - especially of what steps I took to solve the issue. You may laugh of what I did - I did anyway.

The first place I researched was on Google. Not much there. Then I figured my local .NET framework was corrupted (yeah I know already, stop laughing). So I re-installed all the .NET frameworks (.NET 2.0, .NET 3.0, .NET 3.5, & .NET 3.5 Extensions Preview). I'm running Vista. After the reinstalls and resetting IIS7 (stop laughing). I tried the form - still nothing (you can laugh now).

By mistake and ONLY by mistake (I still don't know why I clicked on it), after I clicked on the "not working" submit button, I clicked in the "Contact Us" link and found that there were validation error or "fields not filled in" errors. That's when the other hand called "Stupidity" slapped me in my face. I forgot to include "ValidationGroups". Wow, the agony and pain of my face!

Well, I added validationgroups just to the "Contact Us" form (no need to added validationgroups to every form on the site, just need it on that form) and what do you know? Everything WORKS! So, even if you have a form in a usercontrol or in a modalpopup control, use validationgroups...

Note: Be sure to add a validationgroup to both the control being validated and the validator.

Days wasted on this problem: 2 days

Posted on Tuesday, February 12, 2008 9:00 AM | Back to top


Comments on this post: Note to Self: ValidationGroup is man's best friend...

# re: Note to Self: ValidationGroup is man's best friend...
Requesting Gravatar...
I wasted a day and a half on this, but it probably would have been three days if I hadn't found your blog entry. Thank you!

I resorted to the method of "start with a working example and change it step by step to what you need until it breaks" method, which told me the problem had something to do with validation groups, but your blog entry clarified the problem.
Left by Amy de Buitléir on Mar 25, 2008 5:33 AM

# re: Note to Self: ValidationGroup is man's best friend...
Requesting Gravatar...
Well, I had the exact opposite experience. Wasted a few days trying to figure out why my validators only worked the first time the form loaded, afterwards, it would let the form post even with invalid data. My solution was to remove the use of ValidationGroups since I am basically dealing with only one group. Now all validators work as expected.

Carlos
Left by CarlosRafi on Mar 25, 2008 9:47 AM

# re: Note to Self: ValidationGroup is man's best friend...
Requesting Gravatar...
Hi,
I just stumbled across your blog and was reading through this post and noticed your note at the end "Be sure to add a validationgroup to both the control being validated and the validator".

afaik you don't add the ValidationGroup to the control being validated. You add it to the control that causes validation.

MSDN article for TextBox.ValidationGroup:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.validationgroup.aspx

Note that the ValidationGroup property on TextBox isn't for which group the TextBox belongs to rather which group will be validated if the TextBox causes validation.
Left by steve on Dec 07, 2008 5:25 PM

# re: Note to Self: ValidationGroup is man's best friend...
Requesting Gravatar...
saved my day!!!!!!! great post
Left by Shoaib Shaikh on Nov 24, 2010 6:34 AM

Comments have been closed on this topic.
Copyright © Ray Linder | Powered by: GeeksWithBlogs.net