Changing text color

Forum to discuss the Web client version of Servoy.

Changing text color

Postby mmcmanus » Thu Mar 23, 2006 9:32 pm

I am looking for a way to change the text color of a form label when validation fails. Since I can't use popups I need some way to indicate that an entry is not valid. I have been able to make an entry into the form field. But don't seem to be able to come up with a way to change the color of the text. I tried html text but that does not seem to work either.

I''m sure I am missing something obvious. Any ideas or solutions out there?

Thanks
mmcmanus
 
Posts: 41
Joined: Thu Feb 23, 2006 7:28 pm
Location: Cincinnati, OH

Postby automazione » Thu Mar 23, 2006 11:00 pm

If I figured out what you are trying to obtain just give a name to your label (property name of the label) then you will be able to set the color in the validation method with:

if (value is ok)
elements.your_label_name.fgcolor = '#ff33cc';
else
elements.your_label_name.fgcolor = '#ffffff';


hope this helps
Enrico Arata
Servoy Italia
automazione
 
Posts: 366
Joined: Thu Apr 24, 2003 11:37 am
Location: Torino, Italy

Postby automazione » Thu Mar 23, 2006 11:10 pm

SORRY :oops:

I did not realize you were referring to webclient....
Enrico Arata
Servoy Italia
automazione
 
Posts: 366
Joined: Thu Apr 24, 2003 11:37 am
Location: Torino, Italy

Postby automazione » Thu Mar 23, 2006 11:51 pm

Workaround: place an icon (or a label) in proximity of the field, you can then turn it on/off by method.... Tested with 3.0b1 and works fine!!

elements.your_icon.visible = !elements.your_icon.visible; // switches on-off

also you can change the text of the label....
Enrico Arata
Servoy Italia
automazione
 
Posts: 366
Joined: Thu Apr 24, 2003 11:37 am
Location: Torino, Italy

Changing text color

Postby mmcmanus » Fri Mar 24, 2006 2:56 pm

Well here is what I ended up doing. Which works mostly. I just have to deal with some parsing issues today. the key is the .text in Javascript.

Set the labels to html
Got the text of the label using some like lablename.text
Created 2 globals gStandard gError and put in HTML text for either option
Set the text of the label

alll done! EXCEPT, I forgot to strip the html markup from the gotten label text. Which is this morning task.

Thanks for the ideas
mmcmanus
 
Posts: 41
Joined: Thu Feb 23, 2006 7:28 pm
Location: Cincinnati, OH


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 8 guests