Difference between revisions of "Dependent dropdowns"

From SDU
Jump to: navigation, search
(Introduction)
Line 3: Line 3:
 
On a regular basis, people ask on the forums for a solution implementing dependent dropdowns.
 
On a regular basis, people ask on the forums for a solution implementing dependent dropdowns.
  
With dependent dropdowns, we mean values in a dropdown are depending on a selection made in an earlier dropdown field.
+
;dependent dropdowns
 +
: values in a dropdown are depending on a selection made in an earlier dropdown field.
  
 
Since selecting a value in a dropdown is done client-side, at least some part of the solution will include (client-side) javascript coding.
 
Since selecting a value in a dropdown is done client-side, at least some part of the solution will include (client-side) javascript coding.
  
 
Possible solutions may exist out of these:
 
Possible solutions may exist out of these:
+ use hidden frames to call a custom made HTMPL file containing the values for the next dropdown, then use this data to populate the dropdown in the main window
+
* use hidden frames to call a custom made HTMPL file containing the values for the next dropdown, then use this data to populate the dropdown in the main window
+ an AJAX implementation
+
* an AJAX implementation
+ find a way to call the CA Service Desk web services using javascript, get the necessary values from the server and populate the dropdown
+
* find a way to call the CA Service Desk web services using javascript, get the necessary values from the server and populate the dropdown
+ pre-load all data when your form gets loaded, then use javascript to display values when making selections in the dropdowns
+
* pre-load all data when your form gets loaded, then use javascript to display values when making selections in the dropdowns
  
 
All these solutions will have advantages and disadvantages (e.g. calling webservices, using AJAX and even the 'hidden frame solution' may work a little slower compared to pre-loading all data. On the other hand, pre-loading data may take a long time if you have hundreds of values)
 
All these solutions will have advantages and disadvantages (e.g. calling webservices, using AJAX and even the 'hidden frame solution' may work a little slower compared to pre-loading all data. On the other hand, pre-loading data may take a long time if you have hundreds of values)
Line 18: Line 19:
  
 
== Components ==
 
== Components ==
 +
 +
When a web server gets a request to serve a page it will first parse all server side code (HTMPL) and replace that code with valid HTML code before passing that HTML back to the requester of the page.
  
  
  
 
== All together now ==
 
== All together now ==

Revision as of 09:52, 24 March 2009

Introduction

On a regular basis, people ask on the forums for a solution implementing dependent dropdowns.

dependent dropdowns
values in a dropdown are depending on a selection made in an earlier dropdown field.

Since selecting a value in a dropdown is done client-side, at least some part of the solution will include (client-side) javascript coding.

Possible solutions may exist out of these:

  • use hidden frames to call a custom made HTMPL file containing the values for the next dropdown, then use this data to populate the dropdown in the main window
  • an AJAX implementation
  • find a way to call the CA Service Desk web services using javascript, get the necessary values from the server and populate the dropdown
  • pre-load all data when your form gets loaded, then use javascript to display values when making selections in the dropdowns

All these solutions will have advantages and disadvantages (e.g. calling webservices, using AJAX and even the 'hidden frame solution' may work a little slower compared to pre-loading all data. On the other hand, pre-loading data may take a long time if you have hundreds of values)

Let's take a look at an implementation that pre-loads all data.

Components

When a web server gets a request to serve a page it will first parse all server side code (HTMPL) and replace that code with valid HTML code before passing that HTML back to the requester of the page.


All together now