Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Saving a Biz Form data using the API View modes: 
User avatar
Certified Developer 8
Certified Developer 8
richard - 12/2/2013 9:55:33 PM
   
Saving a Biz Form data using the API
I am using the code found in this example: http://devnet.kentico.com/Knowledge-Base/BizForms/Creating-a-multi-step-form.aspx

The issue I am having is that the data is not saving. Basicform.Data["FirstName"] just has blank values however biz.BasicForm.FieldEditingControls["FirstName"].Value has the correct values ...

Anyone cast any light on 1: why the form won't save; 2: Work arounds

Thanks

Richard


if (biz.BasicForm.Data != null)
{

string fname = ValidationHelper.GetString(biz.BasicForm.FieldEditingControls["FirstName"].Value, "");//has correct value

IDataContainer row = biz.BasicForm.Data;

string firstname = ValidationHelper.GetString(row["FirstName"], String.Empty);//nada

bool saved = biz.BasicForm.SaveData(null, false);//saves nothing!

if (saved) {
if (IsFirstStep)
{
// get id and save it in session so the next step can update the data
Session["MultiStepItemID"] = biz.ItemID;

}
};
}

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/8/2013 8:53:14 PM
   
RE:Saving a Biz Form data using the API
If I remember right:

biz.BasicForm.Data will return the data that is currently in the row.
biz.BasicForm.FieldEditingControls["FirstName"].Value
will get the value of a textbox or control prior to insert or update.

So essentially if you want to do validation prior to insert, you'd use the .FieldEditingControls["fieldName"] and then perform the .SaveData() method, then you can use .Data to retrieve the data submitted.

I could be wrong, its been a while since I've worked with biz form API.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 12/12/2013 8:48:32 AM
   
RE:Saving a Biz Form data using the API
Hi Richard,

Let me also mention the Developers Guide resources: Updating a record and Customization possibilities sections.

Best regards,
Martin Danko