Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Bizform Events View modes: 
User avatar
Member
Member
Armysniper89 - 9/8/2011 7:47:12 PM
   
Bizform Events
Is there a way to know when a user has completed a BizForm so I can do some work and perform some logic on the data? I am looking to use BizForms to create a local survey tool. If not in 5.5 would this be in 6?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 9/8/2011 8:10:17 PM
   
RE:Bizform Events
Hello,

It depends on where you want to run the code. If you want to run it in the bizform directly, you can alter the bizform web part directly. You can use the OnAfterSave event. Here is an example with a different event:

protected void viewBiz_OnAfterValidate()
{
this.viewBiz.ValidationErrorMessage = "Main error message";
string find = "FirstName";
Control cl = this.viewBiz.BasicForm.FindControl(find);

string toValidate = "";

if (cl != null)
{
TextBox tb = (TextBox)cl;
toValidate = tb.Text.ToString().Trim();
}
}

Please note, that you have to register all the mentioned methods in ihe bizform definition:

<cms:BizForm ID="viewBiz" runat="server" IsLiveSite="true" OnOnAfterValidate="viewBiz_OnAfterValidate" OnOnValidationFailed="viewBiz_OnValidationFailed" />


A different approach would be to handle this in a custom data handler. This can be done as described in our documentation. Simply check for the data type which is inserted and execute your code. Or you can place your code into a separate page and redirect the visitor to it after they've submitted the form. This can be done in CMSDesk / Tools / Bizforms / General / "Redirect to URL:".

Best regards,
Boris Pocatko

User avatar
Member
Member
jgriffith-nfusion - 11/23/2011 3:33:06 PM
   
RE:Bizform Events
My form is not saving data now that I have implemented the OnAfterValidate method. It is returning the person to the original form and not redirecting them to the thank you page. Is there something I additional I need to do?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/24/2011 2:57:50 AM
   
RE:Bizform Events
Hello,

If you interrupt the processing of the BizForm you might have to save the data manually:

viewBiz.BasicForm.SaveData("redirect.to.this.url");

Best regards,
Boris Pocatko