Solved

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

Posted on 2004-10-19
4
345 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

932 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

20 Experts available now in Live!

Get 1:1 Help Now