avanin16 wrote:
>
> ------------------------- And I have 3 text fields ,
which I want to
> automatically populate by selecting the Employee Dept
from the drop down
> -------------------------
>
If I understand correctly, you want data to populate the text
fields
based when an option is selected in the select control. If
so, first of
all, this is a client user interface requirement and not
really a server
issue, even though the server *may* get involved in more
sophisticated
solutions.
As a client problem, this is closely related to "two related
selects".
A very common pattern where the values of one select control
is based on
the chosen value in another select control. This patern is
very common
and there are many, well documented examples available for a
bit of
searching. You will need to modify the provided JavaScript
code to
populate text fields rather then another select field, but
that should
be fairly trivial.
Now the real challenge of all of this is where to get the
data to
populate the desired form controls. By the time client code
is running,
the server has completed all its work for this client, moved
on to its
next job and completely forgotten about this request. One can
provide
*all* the possible data for the dynamically populated fields
in the
response to the request. This is fine for smaller data sets,
but
becomes unwieldy as the amount of possible data grows.
Alternately one can make a new request to the server for the
required
data after the choice has been made by the user in the select
control.
If this is done as regular request, it will cause the page to
be
refreshed with the new fields completed. Simple and straight
forward
but this does lead to a rather clunky, blinking user
experience.
With more effort it is possible to make this second response
behind the
scenes using asynchronous JavaScript, commonly known as AJAX.
The
latest version of ColdFusion contains several new functions
to aid one
in the building of AJAX functionality.