ASPX templates
Version 5.x > ASPX templates > Alternative Forms Validation View modes: 
User avatar
Member
Member
gph - 9/9/2010 8:03:28 AM
   
Alternative Forms Validation
I have a template that is using a copy of the bizform web part. On this webpart I specify an AlternativeFormName for my BizForm. When the page loads this produces the desired result, displaying the alternative form. However, when the form is submitted and contains invalid data the page reloads using the default form. The assignment of AlternativeFormName is in the SetupControl() method of you the web part. I have checked that this method runs on every postback, so why it the AlternativeForm being disregarded?
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do nothing
}
else
{
// Set BizForm properties
viewBiz.FormName = this.BizFormName;
viewBiz.SiteName = this.SiteName;
viewBiz.UseColonBehindLabel = this.UseColonBehindLabel;
viewBiz.AlternativeFormFullName = this.AlternativeFormName;
viewBiz.ValidationErrorMessage = this.ValidationErrorMessage;

// Set the live site context
if (viewBiz.BasicForm != null)
{
viewBiz.BasicForm.ControlContext.ContextName = CMS.SiteProvider.ControlContext.LIVE_SITE;
}

viewBiz.OnBeforeSave += new CMS.FormControls.BizForm.OnBeforeSaveEventHandler(viewBiz_OnBeforeSave);
viewBiz.OnAfterValidate += new CMS.FormControls.BizForm.OnAfterValidateEventHandler(viewBiz_OnAfterValidate);
}
}

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 9/29/2010 9:32:03 PM
   
RE:Alternative Forms Validation
Hi,

Have you found anything new about the behavior already?

If not, could you please try to comment out the part with 'BasicForm':
// Set the live site context
if (viewBiz.BasicForm != null)
{
viewBiz.BasicForm.ControlContext.ContextName = CMS.SiteProvider.ControlContext.LIVE_SITE;
}

it seems that on postback, it could cause initialization of the BasicForm earlier than the BizForm values are set, what means preventing the AlternativeForm to be applied (set)...

We are trying to reproduce it, any feedback would be appreciated. Thanks in advance.

Regards,
Zdenek

User avatar
Member
Member
gph - 9/30/2010 9:42:16 AM
   
RE:Alternative Forms Validation
I moved the functionality into an inline control and it works just fine. Unfortunately, I don't have the web part code anymore and I don't have time to re-create the issue.

Thanks for the response though!

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 10/5/2010 8:46:39 AM
   
RE:Alternative Forms Validation
Hi,

That's ok, I'm glad you've resolved the issue.
Thank you for letting us know.

Regards,
Zdenek

User avatar
Member
Member
nvpat - 7/19/2011 3:31:26 PM
   
RE:Alternative Forms Validation
I am having this same problem, except I am using the Bizform directly in an ASPX master page:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="CMSTemplates_CarLot_Site" %>
<%@ Register Src="~/CMSWebParts/BizForms/bizform.ascx" TagName="BizForm" TagPrefix="webpart" %>
.
.
.
<webpart:BizForm runat="server" BizFormName="Contact" AlternativeFormName="BizForm.Contact.ContactHomePage" />

It works fine when I first browse to the page, but if I submit the form (or postback the page in any manner), it then displays the main form, not the alternative one.

I'm using v5.5.4216 R2

Thanks.

User avatar
Member
Member
nvpat - 7/21/2011 12:24:34 PM
   
RE:Alternative Forms Validation
Any ideas on this from the Kentico folks? Should I bring it up in the bug forum?

Thanks.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 7/22/2011 9:25:12 PM
   
RE:Alternative Forms Validation
Hi,

We can continue here and optionally create a bug report ticket.

Could you please specify the master page class definition (at least the header)?

Also, please use AlternativeFormFullName property name, not only AlternativeFormName.

Could you please try if it changes the behavior? If the alternative form is loaded correctly, then it should not change it.

Thank you in advance for information.

Regards,
Zdenek C

User avatar
Member
Member
nvpat - 7/25/2011 11:22:20 AM
   
RE:Alternative Forms Validation
I added the AlternativeFormFullName property but it didn't change the behavior.

Here's the entire class definition of the master page class:
public partial class CMSTemplates_CarLot_Site : TemplateMasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void CreateChildControls()
{
base.CreateChildControls();
this.PageManager = this.CMSPageManager1;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this.ltlTags.Text = this.HeaderTags;

}
}

Thanks.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 8/8/2011 9:17:18 AM
   
RE:Alternative Forms Validation
Hi,

Thank you for your reply.
I'm still investigating this issue in the testing environment. The masterpage code looks fine. I'll get back with more details asap.

Regards
Zdenek C.