Dependent Sections

(by Mark Qian on 9/11/2006)

Introduction

In some situation, such as my example "Silent Form" and on-demand tree, you can optionally use Remote Scripting to do a better job. But in some other cases, you have to use it otherwise it is hard to solve the problem. Dependent section is one of these cases. A page with Dependent sections is divided into more than one sections where content of one section is depended on content of a field in another section. In other words, selection of a Key field in one section will determent what to be loaded in another section. [Why do you place multiple sections in a single page? Show details]. So far, Remote Scripting is not "necessary" yet since you can always send back fields in all the sections to achieve the dependency. But here is a situation where you can only partially load the page which makes the Remote Scripting necessary: in the example below, there are tables in some sections and input fields in the table have no attribute "name". This means that we don't want those input fields in tables to be sent back to the server as parameter when the page is submitted. In other words, the state of these input fields in tables are preserved in the client side and only the client-side calculated result from these table input fields is sent back to the server as a dynamic-built parameter. You may say, well, when I load the next dependent section, I can just send the "calculated result" back to server and then recover the states for the input fields in tables. You can't because users may try to load the dependent section before they complete the tables - in that case you can't calculate the result. But if you send the entire page back the state in tables will be lost. So in this case you have to update your page partially. The following is a demo to show you how the dependent sections be loaded using Mark's Communicator. There is a Key field in each section. Making a selection in the Key field will cause a dependent section to be loaded. Changing the selction in a Key field to see how the dependent section is changed. The newly loaded section also contains a Key field. A selection made on the Key field in the new section will cause another new section to be loaded and so on. The number of sections that can be loaded is infinity so you can load as many section as you can by making selection in the key field...until your browser crash. Note: after making a selection on a Key field, you need to scroll down to to see the newly added section below. Compatibility: IE (6.x, 7.x), FireFox (1.5.0.4), Mozilla/Netscape(7.2), Opera(9.0) were fully tested and worked in XP (v2002. sp2).

Running Code

Transport:


This is section A_0

Key Field
Field_0 Field_1 Field_2 Field_3
Field_4 Field_5