Web Layout
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignWeb Layout

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old November 14th, 2004, 06:53 AM
ljungstrom ljungstrom is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 7 ljungstrom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 32 sec
Reputation Power: 0
Changing color on a form field, dependent on value of the field

Hi all

I have a ASP page where i list and also update records stored in a database. I would like to change background color on the fields if the field has a certain value.

Example: If the value in the <%=(Recordset1.Fields.Item("RecItem1").Value)%> is "x", i want the input field to turn red when I load the page.

The code for the input fields look like this:

<td nowrap><input name="txtField1" type="text" onChange="RecUpdate value="<%=(Recordset1.Fields.Item("RecItem1").Value)%>" size="4"></td>

Any idea?

Best regards

/Bjorn







Reply With Quote
  #2  
Old November 14th, 2004, 10:53 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 35 m 11 sec
Reputation Power: 34
Send a message via AIM to shamrog12
Make sure to dim recItem1Value and backg in the appropriate area

Try this:
Code:
<%
recItem1Value = lcase(Recordset1.Fields.Item("RecItem1").Value)
backg = ""

Select Case recItem1Value
  Case "x"
      backg = " style=""background-color:red;"" "
  Case Else
      backg = ""
End Select
%>

<!-- whatever code here... //-->

<td<%=backg%> nowrap><input name="txtField1" type="text" onChange="RecUpdate value="<%=(Recordset1.Fields.Item("RecItem1").Value)%>" size="4"></td>
__________________
If you found a post of mine helpful, please click on the on my post to add to my reputation.


Reply With Quote
  #3  
Old November 15th, 2004, 09:09 AM
ljungstrom ljungstrom is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 7 ljungstrom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 32 sec
Reputation Power: 0
Thanks :-D

Great thanks, it works

/B

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignWeb Layout > Changing color on a form field, dependent on value of the field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway