Solved

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

Posted on 2004-10-19
4
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

636 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