OnClick of button, get data from database and populate HTML table

Hello fellow ColdFusion programmers.

I'm still somewhat of a novice at ColdFusion.
I have an HTML table on an HTML form. When a user selects the data that he's interested in (date ranges and so forth) and clicks a button on the form to retireve the data,  I want to populate the HTML table with data from a SQL Server database. There could be potentially tens of thousands of records or only a few, so I don't want to get the data until the user has selected the data parameters. Is a hidden frame the best solution?


Who is Participating?
kkhippleConnect With a Mentor Commented:
no u dont need a hidden frame.

the user would select the specified criteria (ie. date range) and that form would submit back to itself (or an action page) and from there you can print out the results.

<CFQUERY DATASOURCE="source" NAME="queryNAme">
   SELECT col1, col2, ...
   FROM tableName
   WHERE ....

   #col1# #col2# ... <BR>


  <CFOUTPUT QUERY="queryNAme">
   <TR><TD>#col1#</TD> <TD>#col2#</TD> ...</TR>
Renante EnteraSenior PHP DeveloperCommented:
Hello Owolowo!

Yah! I agree with kkhipple.  Submit it to the same page.

Most probably, this would be your guide to create the file :

<form action="" method="post">
  <cfif IsDefined('form.viewRecord')>
    <cfquery name="GetRecord" datasource="DSN">
      Select * From TableName
      Where columnName = '#form.selectDate#'
    <!--- Your table here as what kkhipple suggested --->

  <input type="text" name="selectDate" value="defaultvalue">
  <input type="submit" name="viewRecord" value="View">

Hope this helps.

eNTRANCE2002 :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.