Solved

Highlight database output within a form

Posted on 2003-11-10
13
224 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
  • 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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