views:

36

answers:

1

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

A: 

Why would you want to do this with JavaScript, if you already have a server-side solution that works with all browsers?

I'm curious to hear how others would approach the task.

I would just do it on the server.

Thomas
No serious reason, I just wanted to eliminate the sloppy and redundant CFML code.
Stan
How is it redundant, if it's doing something useful?
Thomas