How to Obtain Data to Pre-Populate Forms.

Posted by Stan on Stack Overflow See other posts from Stack Overflow or by Stan
Published on 2009-12-06T15:57:48Z Indexed on 2010/05/31 1:52 UTC
Read the original article Hit count: 358

Filed under:
|
|
|
|

The objective is to have a form reflect user's defined constraints on a search.

At first, I relied entirely upon server-side scripting to achieve this; recently I tried to shift the functionality to JavaScript.

On the server side, the search parameters are stored in a ColdFusion struct which makes it particularly convenient to have the data JSON'ed and sent to the client.

Then it's just a matter of separately iterating over 'checkable' and text fields to reflect the user's search parameters; jQuery proved to be exceptionally effective in simplifying the workload.

One observable difference lies in performance. The second method appeared to be somewhat slower and didn't work in IE8.

Evidently, the returned JSON'ed struct was seen as an empty object. I'm sure it can be fixed, though before spending any more time with it, I'm curious to hear how others would approach the task. I'd gladly appreciate any suggestions.

--Stan

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery