Solved

Highlight database output within a form

Posted on 2003-11-10
13
222 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

17 Experts available now in Live!

Get 1:1 Help Now