Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

help with display

New Here ,
Jan 27, 2010 Jan 27, 2010

Hi All

I have a  page mm.cfm which displays 2 columns from a table in the database, and this page is being called as a template  from a main.cfm .

The columns that are being displayed in mm.cfm are tied to an mm_id in the database which used to be constant till now, the mm_id is being changed i.e,now mm_id can be 1, 2, 3, 4.

now I need to display in  the main.cfm these mm_ids as links so that when i click those links the data in the mm.cfm linked to that id needs to be displayed.

I am new to javscripting, please help me out with this task

thanks in advance

TOPICS
Getting started
471
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 27, 2010 Jan 27, 2010

You don't need javascript.  On main.cfm, run a query to get the id's.  Then use cfoutput, query = that query, to attach the id's to the links.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 17, 2010 Feb 17, 2010

If you don't mid working with CFML instead of JavaScript, in mm.cfm, you could do something like this:

<cfquery name="MyQuery" Datasource="MyDSN">

     SELECT     Column1, Column2, mm_id

     FROM     MyTable

</cfquery>

Then, you could do something like this:

<table align="center" border="0" cellpadding="3" cellspacing="3">
<tr>
     <td>
         <strong>
             mm_id
            </strong>
        </td>
        <td>
         <strong>
             Column1
            </strong>
        </td>
        <td>
         <strong>
             Column2
            </strong>
        </td>
    </tr>
    <cfoutput query="MyQuery">
     <tr>
            <td>
                  <a href="SomeDetailPage.cfm?mm_id=#mm_id#">#mm_id#</a>
            </td>
            <td>
                  #Column1#
            </td>
            <td>
                  #Column2#
            </td>
        </tr>
    </cfoutput>
</table>

I hope this makes sense...

   Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2010 Feb 20, 2010
LATEST

You could do something like this

main.cfm

=========

<cfloop from="1" to="4" index="idx">
<cfoutput><a href="javascript:ColdFusion.navigate('mm_id.cfm?id=#idx#', 'mainPageDiv')">id = #idx#</a></cfoutput><br>
</cfloop>

<!--- container to display query result from mm_id.cfm in the main page --->

<cfdiv name="pageDiv" id="mainPageDiv"></cfdiv>

mm_id.cfm

==========

<cfif isNumeric(url.id) and url.id EQ int(url.id)><!--- if an integer --->
    <cfquery name="qry" datasource="myDSN">
        select * from myTable
        where id = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">
    </cfquery>
   
    <!--- the data to be displayed, for example, dump  --->
    <cfdump var="#qry#">
</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources