Search code examples
coldfusioncfquery

Create cfquery object from HTML table


I know this sounds backwards... yes, I want to know how to create a cfquery object from an already created HTML table. Here's my use case:

1) I've created a cfquery object and have some data

2) I've looped over the cfquery and created the HTML table

3) Now I've run some custom javascript to add more columns to the HTML table (e.g., my original cfquery had week number and I wanted to add Week Day monday-based so I did that)

4) So now I have an HTML table that is different from my cfquery object and I want to create an export of the data in the HTML table using some cfscript I already have but the cfscript takes in cfquery

Now I'm stuck at this so called step 4. What's the best way to create a cfquery object from HTML table sort of reverse engineering that back into a cfquery object?


Solution

  • Doing all of that server side is the way to go. But answering the original question just for giggles...

    What you could do is serialize the table data into json format. Convert a HTML table data into a JSON object in jQuery Send that to CF with a POST operation.

    Then deserialize the post data into a query object. https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DeserializeJSON.html