prepopulate BizForm fields

Naresh Ede asked on August 29, 2017 14:30

Hi i had created a form in Forms Application with some fields.

And i used that form in a page using "Online Form" web part.

Now I want to prepopulate the bizform based on custom table data, so can i do it in layout ascx code.

If possible then please tell me how to pre populate using BizForm Api or any other way.

Recent Answers


Brenden Kehren answered on August 29, 2017 14:56

You can make the controls dynamic in nature to display say a list of options by setting your field control to a dropdown list. Then in options below select a SQL Query and add your query to the custom table that returns the value and text of the dropdown list.

If you're not looking to prepopulate it that way, then please provide more detail.

0 votesVote for this answer Mark as a Correct answer

Naresh Ede answered on August 30, 2017 03:43

I'm getting 5 values from query string,

and i want to fill those values in corresponding textboxes present in bizform.

0 votesVote for this answer Mark as a Correct answer

Naresh Ede answered on August 30, 2017 03:44

I'm getting 5 values from query string,

and i want to fill those values in corresponding textboxes present in bizform.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on August 30, 2017 09:44

Naresh, could you please explain this more? Complete scenario, On what basis will you capture data from Custom tables. Are you doing this Portal Engine or ASCX code?

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

Naresh Ede answered on August 30, 2017 10:15

I want to do it using ASCX code.

actually i'm getting data from custom table using ItemId and populate the record values in bizform fields.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on August 30, 2017 10:39

You can do all this in the portal engine itself. As Brenden mentioned you need to populate your fields through an SQL expression in the fields setting. Then you will have to pass ItemId to access data for a particular record. The item id I guess will be part of your URL? If that's the case it can be fetched as QueryString.GetValue("ItemId"). Here ItemdId will be you QueryString parameter name.

0 votesVote for this answer Mark as a Correct answer

Naresh Ede answered on August 30, 2017 10:44

and how can i assign value to control in bizform using ASCX code.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on August 30, 2017 11:00

I am not much proficient with ASCX code. That's how I think it can be done. But first of all why ASCX? why not Portal Engine?

Below is the reference link to the BizForm Class/events/properties. You should be able to find your answer here

https://devnet.kentico.com/docs/8_2/api/html/T_CMS_OnlineForms_BizForm.htm

  1. On BizForm load first get the data for a particular id from a CT using CustomTablesItemProvider.
  2. Do type casting and error handling for the data you receive from CT.
  3. On OnLoad method of BizForm access the field you want to pre-populate and assign the value.

This should do the trick.

p.s :- You can also see the solution provided by Rocky here. Rocky is Kentico's developer advocate - https://stackoverflow.com/questions/29668621/how-to-sign-value-to-a-field-in-bizform-in-kentico-8-2

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 30, 2017 13:50

Follow the Kentico API Examples. Then create a where clause based on your query string parameters and pass that where clause to the API call.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.