<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Manually validate</title><link>https://www.infopathdev.com:443/forums/thread/32244.aspx</link><pubDate>Mon, 15 Sep 2008 04:24:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:32244</guid><dc:creator>Jonesie</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/32244.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=32244</wfw:commentRss><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;We have a large form in 5 views that is running in Forms Server - web only.&amp;nbsp; The validation messages and required field message displayed by Forms Server are fugly so we used a bunch of rules, a reference &amp;quot;error&amp;quot; attribute and a bit of xpath on a custom submit button to make things look better.&amp;nbsp; The problem is the customer is not happy to do all this work for the remaining 20 or so forms they need.&amp;nbsp; Instead they want to transfer all that complexity to C# ... go figure!&lt;/p&gt;
&lt;p&gt;Anyways, I think the way to do this is to create a submit handler that will do the validation and cancel or not.&amp;nbsp; This is easy enough, but it means moving all the validation logic to code.&lt;/p&gt;
&lt;p&gt;So, finally, my questions:&lt;/p&gt;
&lt;p&gt;1) is it possible to execute the validation settings in controls from code?&amp;nbsp; Eg, by looping through all the controls in the collection?&lt;/p&gt;
&lt;p&gt;2) is it possible to disable the default validation?&amp;nbsp; I created a real simple form with required fields and the default validation fires before submitting, regardless of what I do in the submit handler.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks muchly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>