Solved

Highlight database output within a form

Posted on 2003-11-10
13
226 Views
Last Modified: 2013-12-24
I have the following code, and I would like to have the font be either bold or change color or something happen when the user clicks on one of the database outputs.  I currently have a column that puts an X next to the one that is selected.  I would rather have the entire row of data change as noted above.  How do I do this?

Here is the code.

  <cfoutput query="getaccountcontact">
  <tr>
    <td><cfif getaccountcontact.contactid eq #url.contactid#>X</cfif></td>
      <td><a href="index.cfm?account=#url.account#&contactid=#contactid#" class="basic">#trim(Contactlastname)#, #trim(contactfirstname)#</a></td>
      <td><table><tr><td>#contactareacode#-</td><td>#contactprefix#-</td><td>#contactnumber#</td></tr></table></td>
      <td>#extension#</td>
      <td>#trim(Department)#</td>
      <td>#trim(title)#</td>
      <td>#email#</td>
  </tr>
  </cfoutput>


Thanks.
0
Comment
Question by:swartout
[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
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9715427

 <cfoutput query="getaccountcontact">


----->  <tr  onClick="this.style.backgroundColor='whitesmoke'"> <---------


    <td><cfif getaccountcontact.contactid eq #url.contactid#>X</cfif></td>
     <td><a href="index.cfm?account=#url.account#&contactid=#contactid#" class="basic">#trim(Contactlastname)#, #trim(contactfirstname)#</a></td>
     <td><table><tr><td>#contactareacode#-</td><td>#contactprefix#-</td><td>#contactnumber#</td></tr></table></td>
     <td>#extension#</td>
     <td>#trim(Department)#</td>
     <td>#trim(title)#</td>
     <td>#email#</td>
  </tr>
  </cfoutput>
0
 

Author Comment

by:swartout
ID: 9715565
I saw where the background color changed, however, since I have the page "refreshing" with new criteria after you click, the color change goes away.
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9716582
Then you probably need to set a cookie or something to trap the color change.  But I think I answered your first if you need the second question answered you should post a new question.
0
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
LVL 2

Expert Comment

by:jonnygo55
ID: 9716665
I dont think you need to set a cookie try:

<cfoutput query="getaccountcontact">


 <tr <cfif getaccountcontact.contactid eq #url.contactid#>bgcolor="blue"</cfif>> <---------


     <td><a href="index.cfm?account=#url.account#&contactid=#contactid#" class="basic">#trim(Contactlastname)#, #trim(contactfirstname)#</a></td>
     <td><table><tr><td>#contactareacode#-</td><td>#contactprefix#-</td><td>#contactnumber#</td></tr></table></td>
     <td>#extension#</td>
     <td>#trim(Department)#</td>
     <td>#trim(title)#</td>
     <td>#email#</td>
  </tr>
  </cfoutput>
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 9719022
Try this one :

  <cfoutput query="getaccountcontact">
  <tr onclick="document.location=''index.cfm?account=#url.account#&contactid=#contactid#"<cfif getaccountcontact.contactid eq #url.contactid#>bgcolor="blue"</cfif>>
    <td><cfif getaccountcontact.contactid eq #url.contactid#>X</cfif></td>
     <td><a href="index.cfm?account=#url.account#&contactid=#contactid#" class="basic">#trim(Contactlastname)#, #trim(contactfirstname)#</a></td>
     <td><table><tr><td>#contactareacode#-</td><td>#contactprefix#-</td><td>#contactnumber#</td></tr></table></td>
     <td>#extension#</td>
     <td>#trim(Department)#</td>
     <td>#trim(title)#</td>
     <td>#email#</td>
  </tr>
  </cfoutput>

Goodluck!
eNTRANCE2002 :-)
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9720084
Yes u'll have to pass on the values in hidden form fields - so as to be able to show the rows clicked by teh users, in diff color even after refreshing.

if u have css - it wld make things a lot easier for u

PS : just use a identifier for each row & chk if the rowID is present in the list of selected rows using - listcontains.
0
 

Author Comment

by:swartout
ID: 9723016
entrance 2002, this works, however, can I change the font color rather than the background color?
0
 
LVL 2

Expert Comment

by:jonnygo55
ID: 9723687
you can change whatever you like...
<tr onclick="document.location=''index.cfm?account=#url.account#&contactid=#contactid#"<cfif getaccountcontact.contactid eq #url.contactid#>class="highlightedClass"<cfelse>class="basic"</cfif>>

just put the changes you like in the different css classes
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 9727100
Sure ! you can change the font color.

You can have it this way :

  <cfoutput query="getaccountcontact">
  <tr onclick="document.location=''index.cfm?account=#url.account#&contactid=#contactid#"<cfif getaccountcontact.contactid eq #url.contactid#>bgcolor="blue"</cfif>>
    <td><cfif getaccountcontact.contactid eq #url.contactid#>X</cfif></td>
    <td><font color=<cfif getaccountcontact.contactid eq #url.contactid#>"blue"<cfelse>"red"</cfif>>
    <a href="index.cfm?account=#url.account#&contactid=#contactid#" class="basic">#trim(Contactlastname)#, #trim(contactfirstname)#</a>
    </font></td>
  <td>
  <table>
    <tr>
      <td><font color=<cfif getaccountcontact.contactid eq #url.contactid#>"blue"<cfelse>"red"</cfif>>#contactareacode#-
      </font></td>
      <td><font color=<cfif getaccountcontact.contactid eq #url.contactid#>"blue"<cfelse>"red"</cfif>>#contactprefix#-
      </font></td>
      <td><font color=<cfif getaccountcontact.contactid eq #url.contactid#>"blue"<cfelse>"red"</cfif>>#contactnumber#
      </font></td>
    </tr>
  </table>
  </td>
     <td>#extension#</td>
     <td>#trim(Department)#</td>
     <td>#trim(title)#</td>
     <td>#email#</td>
  </tr>
  </cfoutput>

Regards!
eNTRANCE2002 :-)
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 9727121
Ooops! By the way, I forgot to remove the line :

    <cfif getaccountcontact.contactid eq #url.contactid#>bgcolor="blue"</cfif>

This line will cause conflict to the changing of font color 'coz I specify "blue" color for the font.  There would be a tendency that you might not see the text since its background is blue and font color is blue.  Better remove the specified line.

Thank you.

Best wishes!
eNTRANCE2002 :-)
0
 
LVL 14

Accepted Solution

by:
Renante Entera earned 125 total points
ID: 9728501
But actually to make it simplier, have it this way :

<tr onclick="document.location=''index.cfm?account=#url.account#&contactid=#contactid#"<cfif getaccountcontact.contactid eq #url.contactid#>style="color:blue"</cfif>>

Instead of setting font color column by column set it in a row passing a value for the parameter "style"...

See u!
eNTRANCE2002 :-)
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 9735993
Thanks for the points and A.

Hope to help you again...

Regards!
eNTRANCE2002 :-)
0
 
LVL 2

Expert Comment

by:jonnygo55
ID: 9736023
wierd...I pretty much gave the accepted answer about 8 posts ago...
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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