Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > BizForm depending fields page reloads View modes: 
User avatar
Member
Member
matthew.newby-crl - 7/18/2013 2:08:13 PM
   
BizForm depending fields page reloads
While building a bunch of forms over the past few weeks, one thing I've failed to figure out is how to use the "Has depending fields" and "Depends on another field" checkboxes to alter other fields based on the selected value of the first field, without causing a page reload.

Let's consider a customer RFQ form. At the top of the form, I collect a bunch of customer related data such as name, phone number, email, company, address, etc. Below that I have a few related drop-down fields for category and subcategory of interest, and further down, some more fields such as "how did you hear about us", and a captcha. Depending on what category the customer chooses from the first drop down, I want to populate the subcategory drop down with choices that apply to that category.

As I'm building the form in CMS Desk, I check the checkbox on the RFQCategory field for "Has depending fields", and set the options to something like:
Category ABC;Category ABC
Category DEF;Category DEF
...
Category XYZ;Category XYZ

Then, for the purposes of experimentation, I create several RFQSubcategoryABC, RFQSubcategoryDEF, RFQSubcategoryXYZ, etc. drop down fields with different options in each, check the checkbox for "Depends on another field", and set the visibility condition as this example shows:
RFQCategory.Value = "Category ABC"

And so on with the other subcategory fields. (Of course, ultimately, I'd like to create a custom table, put my subcategory choices there along with the category they're associated with, and use SQL to generate the list of available subcategory options, keeping the different subcategory fields in just one field.)

When the page initially loads, I see the category field and pick a subcategory from it. Problem: As soon as I click on my choice, Kentico does a full page reload, and repositions the document at the top in the browser window, even though I was a screen or two down when I looked at the category field. And since I wasn't at the bottom of the form, now I've got to hunt to figure out where I was when the page reloaded.

The task of altering part of a web form based on choices made in some fields is not a new one, and has been solved outside of Kentico in several different ways: JavaScript to show/hide elements using their ID attributes where the depending fields are placed on the page but their visibility is set to not be shown, JavaScript to programmatically change the options listed in the depending fields, and more recently leveraging AJAX to make the page behavior feel more interactive. Kentico's behavior, on the other hand, appears to be limited to a postback with a full page reload in order to figure out that it needs to show one of the hidden fields.

Question: Is there any way to use the out of the box features in the CMS Desk or Site Manager to allow updates to depending fields without page reloads? If so, how?

Thanks!

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 7/18/2013 8:47:34 PM
   
RE:BizForm depending fields page reloads
In the Bizform webpart after you set all your properties, set the scroll towards the bottom to the AJAX section and check the Use update panel checkbox. This should help your problem.

User avatar
Member
Member
matthew.newby-crl - 7/19/2013 9:26:40 AM
   
RE:BizForm depending fields page reloads
Again, FroggEye, I find myself in your debt! Now I seriously want to go and rework a bunch of forms that have already been QA tested. We're just about a week away from a site launch, so it's going live as is...

For a little more clarity to the instructions, I went to the CMS Desk, then in the Content tree, I clicked on the page document where the BizForm is instanced. I changed to Design view, then clicked the Configure gear for the Page Content webpart (I suspect it may be named something different on another site). I then scrolled down -- you can use the quick link in the left hand stack of links -- to the AJAX section, and hit the checkbox for Use update panel. Now the page is updating without reloading.

Thank you, thank you, thank you!

User avatar
Member
Member
matthew.newby-crl - 7/19/2013 10:15:08 AM
   
RE:BizForm depending fields page reloads
A couple side notes/thoughts:

First, this setting is buried quite a bit, and not terribly obvious to find. I'd recommend that Kentico make the setting easier to find.

Second, I'm disappointed that this is a function of the webpart rather than of the form. This means that in order to prevent page reloads, I'll have to check the AJAX update panel setting every time I drop the form onto a new page. I'd recommend that Kentico make tie the use of the AJAX update panel to the form, rather than to the webparts where the form is instanced.

Third, and somewhat related to the previous observation, having the checkbox checked is not the default behavior of the webpart. I cannot imagine a scenario where I'd want so-called dynamic content on a page to require a full page reload to see the updated data. I'd recommend that Kentico default the Use update panel checkbox to checked, rather than unchecked.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 7/19/2013 5:25:34 PM
   
RE:BizForm depending fields page reloads
matthew.newby-crl wrote: First, this setting is buried quite a bit, and not terribly obvious to find. I'd recommend that Kentico make the setting easier to find.

Second, I'm disappointed that this is a function of the webpart rather than of the form. This means that in order to prevent page reloads, I'll have to check the AJAX update panel setting every time I drop the form onto a new page. I'd recommend that Kentico make tie the use of the AJAX update panel to the form, rather than to the webparts where the form is instanced.
Leaving it with the webpart makes sense as the webpart could have several controls included with it. Putting it on the Biz Form is not ideal because it will only be included for that one particular form/control.

matthew.newby-crl wrote: Third, and somewhat related to the previous observation, having the checkbox checked is not the default behavior of the webpart. I cannot imagine a scenario where I'd want so-called dynamic content on a page to require a full page reload to see the updated data. I'd recommend that Kentico default the Use update panel checkbox to checked, rather than unchecked.
You can set defaults of webparts by going to Site Manager>Development>Webparts and selecting the webpart you want to modify. Go to the System Properties tab of the particular webpart and uncheck the "inherited" checkbox and set your own value. From then on out, all the webparts that are added will have those new default values. If you want to change any already on a template, you will have to manually update them.

Glad to help!