Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: changing button color in form Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: August 10 2007 at 05:44 | IP Logged Quote krommetje

Hi all

suppose I have a form on a webpage with a button and I wanted to change the colour of the button according to the status of the device assigned to the button... how would I do this?

(red for OFF bue for ON)

Like so?

<% if( [X10STATK4] = 1, <input type="submit" value="Voordeur Rolluik Open" style="color: "blue"; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: #99ccff"> , <input type="submit" value="Voordeur Rolluik Open" style="color: "Red"; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: #99ccff"> ) %>

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: August 10 2007 at 08:01 | IP Logged Quote TonyNo

Try this...

Code:
<input type="submit" value="Voordeur Rolluik Open" style="color: <% if( [X10STATK4] = 1, 'blue', 'red') %>"; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: #99ccff">
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: August 13 2007 at 09:20 | IP Logged Quote krommetje

Hey that is neat, thanx TonyNo

what if I wanted to change the color of the text as well? it seems this doesn't work when I try this:

Code:

<form method="get" action="/ph-cgi/playmacro">
<input type="hidden" name="id" value="EETKAMERLAMP AAN">
<input type="hidden" name="nexturl" value="/test.psp">
<input type="submit" value="EETKAMERLAMP AAN" style="color: <% if( [X10STATK2] = 1, 'Black', 'Yellow') %>"; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: <% if( [X10STATK2] = 1, 'White', 'blue') %>">
</form>


The text changes but the background doesn't...

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: August 13 2007 at 13:29 | IP Logged Quote TonyNo

If it's a button, you can't change the BG color, AFAIK.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: August 15 2007 at 08:35 | IP Logged Quote krommetje

If I am not mistaken this piece of code does:

Code:

<input type="submit" value="Voordeurrolluik Dicht" style="color: #003366; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: <% if( [X10STATK4] = 1, 'blue', 'red') %>">


But I can only change the colour OR the FontColour not both..I would like to though...

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: August 15 2007 at 13:36 | IP Logged Quote TonyNo

Well, I'll be! You can change the button color.

Ah ha! Your quotes are different.

This should work...

Code:
<form method="get" action="/ph-cgi/playmacro">
<input type="hidden" name="id" value="EETKAMERLAMP AAN">
<input type="hidden" name="nexturl" value="/test.psp">
<input type="submit" value="EETKAMERLAMP AAN" style="color: <% if( [X10STATK2] = 1, 'Black', 'Yellow') %>; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: <% if( [X10STATK2] = 1, 'White', 'blue') %>">
</form>

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: August 18 2007 at 02:33 | IP Logged Quote krommetje

if you were a girl I'd give you one right smack on the lips!

Peter

Edited by krommetje - August 18 2007 at 02:34
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum