Solved

Highlight database output within a form

Posted on 2003-11-10
13
221 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

13 Experts available now in Live!

Get 1:1 Help Now