Multiple forms on same page Validates All

Oct 11, 2013 at 7:59 PM
Is there a way to have multiple forms on one page that act independently?
Oct 12, 2013 at 9:43 PM
Try with forms without "<asp:RequiredFieldValidator"

Regards,
Gino.
Oct 14, 2013 at 10:45 PM
Can we not add a validation group: validationgroup="Form1" to each of the fields needing validation and to the submit button? The submit button is giving me trouble as it is replaced by a parameter in the admin.
Oct 16, 2013 at 3:12 AM
Hi, I think that adding this line:
                  btnSubmit.ValidationGroup = FormName
After this one:
                  Dim btnSubmit As New LinkButton
In the FormBuilder.asc.vb file
Will do the trick. (module recompile required)

With this modification you can use the Form name as the validation group in all your fileds.

Regards,
Gino.
Oct 17, 2013 at 3:48 PM
Edited Oct 17, 2013 at 7:47 PM
Unfortunately, I don't really develop that much anymore and only have Visual Studio 2008 v9

-- Regards,
Ken Purcell
Oct 17, 2013 at 4:07 PM
Hi, are you using "DNN Quick Form 01.00.01 Install" from this site?

Gino.
Oct 17, 2013 at 4:12 PM
Yes sir, I installed the module ver 01.00.01 works great, except when I have two similar forms on the same page (don't ask, client choice). And then got the source so I could try your suggestion. Unfortunately I have not been doing any development is the last few years and only have VS 2008.

Ken
Oct 17, 2013 at 5:55 PM
OK, I've made that change, but I didn't test it.
Here is the link to download the modified version of DNNQuickForm.dll

https://dl.dropboxusercontent.com/u/101274719/DNNQuickForm2.zip

Hope it work :-)

Gino
Oct 17, 2013 at 7:07 PM
You my friend are a true gentleman! I'll let you know how it goes.

Thanks!
Oct 17, 2013 at 7:46 PM
Well I replaced the DNNQuickForm.dll with the new one in httpdocs/bin and it crashes. If I put back the original dll it works again. I really appreciate you trying to help me but I understand if this is too much to deal with. Thanks!

Here is the error I get with the new dll:

Error: DNN Quick Form is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Could not load type 'DNNQuickForm.FormBuilder'. ---> System.Web.HttpParseException: Could not load type 'DNNQuickForm.FormBuilder'. ---> System.Web.HttpParseException: Could not load type 'DNNQuickForm.FormBuilder'. ---> System.Web.HttpException: Could not load type 'DNNQuickForm.FormBuilder'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.WebFormsModuleControlFactory.CreateModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration) at DotNetNuke.UI.Modules.ModuleControlFactory.LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---
Oct 17, 2013 at 9:54 PM
Sorry, my mistake, please try again with this one: https://dl.dropboxusercontent.com/u/101274719/DNNQuickForm3.zip

Regards,
Gino.
Oct 17, 2013 at 10:34 PM
That does not kill the page like before but still hits both validators. You can see it here: (http://lightfair2013.com/Welcome/Contact/tabid/134/Default.aspx)

Here is the code for the DNN Quick Form

Form 1 Named: ContactForm.ascx

<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
<div class="dnnForm1"> <div class="dnnFormItem"> <dnn:label runat="server" Text="Name" HelpText="Please enter your name in the space provided" Suffix=":" /> <asp:textbox id="Name" runat="server" CssClass="dnnFormRequired" /> <asp:RequiredFieldValidator ID="Form1Validator1" ControlToValidate="Name" cssclass="dnnFormMessage dnnFormError" runat="server" Text="Name is required" validationgroup="ContactForm" /> </div> <div class="dnnFormItem"> <dnn:label runat="server" Text="Email" HelpText="Please enter your email address in the space provided" Suffix=":" /> <asp:textbox id="Email" runat="server" CssClass="dnnFormRequired" /> <asp:RequiredFieldValidator ID="Form1Validator2" ControlToValidate="Email" cssclass="dnnFormMessage dnnFormError" runat="server" Text="Email Address is required" validationgroup="ContactForm" /> </div> <div class="dnnFormItem"> <dnn:label runat="server" Text="Comments" HelpText="Please send us your comments" Suffix=":" /> <textarea id="Comments" rows="6" runat="server"></textarea> </div> <div style="clear:both;"> <asp:placeholder id="plhButton" runat="server" /> </div> </div> Form 2 Named: FooterContaxtForm.ascx

<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
<div class="dnnForm2"> <div class="dnnFormItem"> <dnn:label runat="server" Text="Name" HelpText="Please enter your name in the space provided" Suffix=":" /> <asp:textbox id="Name" runat="server" CssClass="dnnFormRequired" /> <asp:RequiredFieldValidator ID="Form2Validator1" ControlToValidate="Name" cssclass="dnnFormMessage dnnFormError" runat="server" Text="Name is required" validationgroup="FooterContaxtForm" /> </div> <div class="dnnFormItem"> <dnn:label runat="server" Text="Email" HelpText="Please enter your email address in the space provided" Suffix=":" /> <asp:textbox id="Email" runat="server" CssClass="dnnFormRequired" /> <asp:RequiredFieldValidator ID="Form2Validator2" ControlToValidate="Email" cssclass="dnnFormMessage dnnFormError" runat="server" Text="Email Address is required" validationgroup="FooterContaxtForm" /> </div> <div class="dnnFormItem"> <dnn:label runat="server" Text="Zip" HelpText="Please enter your zip" Suffix=":" /> <asp:textbox id="Zip" runat="server" CssClass="dnnFormRequired" /> <asp:RequiredFieldValidator ID="Form2Validator3" ControlToValidate="Zip" cssclass="dnnFormMessage dnnFormError" runat="server" Text="Zip is required" validationgroup="FooterContaxtForm" /> </div> <div class="dnnFormItem"> <dnn:label runat="server" Text="Comments" HelpText="Please send us your comments" Suffix=":" /> <textarea id="Comments" rows="6" runat="server"></textarea> </div> <div style="clear:both;"> <asp:placeholder id="plhButton" runat="server" /> </div> </div>
Oct 17, 2013 at 10:46 PM
I see..., try using "ContactForm.ascx" and "FooterContaxtForm.ascx" as validationgroup names.

Regards,
Gino
Oct 17, 2013 at 10:51 PM
That did it! I was using the form name as entered in the DNN Quick Form name field.

Wow, thanks for your above and beyond assistance.
Oct 18, 2013 at 2:39 PM
Arrrggh,

It works as long as there is no data in the fields, if you click submit it then shows the appropriate labels to that form telling you to enter the missing info. Once you have the fields filled and click submit it then pops up the other forms validators warning?!

Try it: (http://lightfair2013.com/Welcome/Contact/tabid/134/Default.aspx)

Ken
Oct 18, 2013 at 10:15 PM
Hi,

I found the problem.
And changed this line in FormBuilder.ascx.vb:
          Page.Validate()
to
          Page.Validate(GetString("DNNQF_FormName", String.Empty))
https://dl.dropboxusercontent.com/u/101274719/DNNQuickForm4.zip

Regards,
Gino.
Marked as answer by kpurcell on 10/18/2013 at 3:36 PM