Solved

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

Posted on 2004-10-19
4
341 Views
Last Modified: 2013-12-20
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?

Thanks

0
Comment
Question by:Owolowo
4 Comments
 
LVL 5

Accepted Solution

by:
kkhipple earned 125 total points
ID: 12354175
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 ....
</CFQUERY>

<CFOUTPUT QUERY="queryNAme">
   #col1# #col2# ... <BR>
</CFOUTPUT>

OR

<TABLE>
  <CFOUTPUT QUERY="queryNAme">
   <TR><TD>#col1#</TD> <TD>#col2#</TD> ...</TR>
  </CFOUTPUT>
</TABLE>
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 12354307
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#'
    </cfquery>
    <!--- Your table here as what kkhipple suggested --->
  </cfif>

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

Hope this helps.


Goodluck!
eNTRANCE2002 :-)
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now