Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Can i programmatically add fields to a BizForm at runtime? View modes: 
User avatar
Member
Member
john-wakefly - 8/18/2009 7:58:31 AM
   
Can i programmatically add fields to a BizForm at runtime?
Is there any way to programmatically add a field to a BizForm at runtime? Basically I need to show/hide a field depending on whether or not the user is logged in. Has anyone done anything like this before?

The BizForm control is great, but unfortunately most of the functionality is under the hood in the DLL and inaccessible (from what I can see).

Any ideas? Thanks in advance!

User avatar
Member
Member
john-wakefly - 8/18/2009 9:54:39 AM
   
RE:Can i programmatically add fields to a BizForm at runtime?
Or, If I could popup another form, after the original form has been submitted, but before the data is sent to the database, that would work too. For example:

User submits BizForm
User is presented with additional form with one field
User fills out field and submits form again.
Data is submitted along with the additional field.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/19/2009 5:44:40 AM
   
RE:Can i programmatically add fields to a BizForm at runtime?
Hi,

you can create a custom form control to achieve the functionality for (non)authenticated users. In this control you will check the current user and according to it you will display/hide the field.

Regarding the second question. for this you can use alternative forms. You will need to modify the code of the bizform web part. At first, alternative form A will be displayed, after it is submitted, you will handle OnAfterSave event, in this event you will hide the form A and display alternative form B with the additional field. On the next submit you will call update on the bizform data to merge them.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
AP-Kentico - 8/28/2009 12:30:41 PM
   
RE:Can i programmatically add fields to a BizForm at runtime?
I have a big form which I want to divide in multiple pages. How can I achieve this using the bizforms?

User avatar
Member
Member
zhaojicheng-artmtech - 8/29/2009 12:06:50 AM
   
RE:Can i programmatically add fields to a BizForm at runtime?
I think you would better use the server control asp:wizard for your data acquisition then save the data to bizform use bizform api.

User avatar
Member
Member
AP-Kentico - 8/31/2009 1:21:43 PM
   
RE:Can i programmatically add fields to a BizForm at runtime?
Well, this works fine, accept all the input from the wizard pages and submit it to bizform form table.

The problem with this approach is that this becomes custom solution and adding new fields becomes a problem.

Please refer to this article:
http://www.sagecraft-studios.com/jquery/wizard-form-demo.html

I was thinking if there is a way to use jquery styling to hide/show containers/pages, it will be nice.

Let me know if this is feasible and how if yes.

Thanks,
AP

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 9/1/2009 3:40:12 AM
   
RE:Can i programmatically add fields to a BizForm at runtime?
Hello,

Please note that I've already reply to you in another thread however I paste it here just to let other users know.

It's possible to achieve multi paged BizForm using Alternative forms of appropriate BizForm. First of all, you need to create all of the necessary BizForm fields with allow empty value property checked. Then you need to create as many alternative forms for your BizForm as the number of pages you require. Each alternative form will be configured to show only fields you require to be displayed on that alternative form - page.

Then you would need to modify BizForm webpart (please create copy of the webpart first): ~\CMSWebParts\BizForms\bizform.ascx and add some for example "next" button to this web part. The aim of this “next” button will be to change Alternative form (viewBiz.AlternativeFormFullName) and also to save the BizForm data (viewBiz.BasicForm.SaveData(string redirect_to_URL)). After first page is saved, Bizform entry is created and you need then just to update existing one using BizForm API:

devnet.kentico.com/docs/devguide/bizforms_api.htm

Anyway out of the box feature will be available in one of the next versions - I'm sorry but there is no exact specification for that yet.

Best regards
Ondrej Vasil

User avatar
Member
Member
seanbun - 9/3/2009 2:42:19 AM
   
RE:Can i programmatically add fields to a BizForm at runtime?
Hi guys,

I agree Multiple page is a great feature for bizform. I am looking forward to seeing this feature. While it would be considered as a new requirement for bizform in the future version of Kentico, I would like to suggest to add Confirmation page as well which allow users to preview all data before submission.

Right now, I've used jquery to generate a confirmation page before form submission, and it takes me long time to do the implementation and maintenance the code.

Cheers,
Matt

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 9/3/2009 6:01:04 AM
   
RE:Can i programmatically add fields to a BizForm at runtime?
Hello,

That sounds pretty reasonable. I'll add this requirement for consideration to our product manager.

Thank you for your feedback. We appreciate it.

Best Regards
Ondrej Vasil