Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Conditional Formatting

Locked
Mx32
Posts: 4
Joined: Tue May 15, 2012 10:15 pm

Conditional Formatting

Unread post by Mx32 »

Is it possible to change the formatting of objects programmatically? I want to turn a Text object to red font if a condition is met. Any idea will be appreciated. Thanks
Last edited by Mx32 on Thu Jun 07, 2012 2:19 am, edited 1 time in total.
admin
Site Admin
Posts: 2824
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Conditional Formatting

Unread post by admin »

MX32,

Put something like this in the JavaScript section of the form your field is on..

Code: Select all

function fldColor(pThis){
   if(pThis.vale == 'bad'){
      pThis.style.color = 'red';
   }else{
      pThis.style.color = 'black';
   }
}
and

Code: Select all

fldColor(this)
in the onChange of the object.

Steven
Mx32
Posts: 4
Joined: Tue May 15, 2012 10:15 pm

Re: Conditional Formatting

Unread post by Mx32 »

Thank you Steve,
It worked perfectly (just correcting the typo in ".value") no further customization needed for my application, thanks for taking the time to help! :)
admin
Site Admin
Posts: 2824
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Conditional Formatting

Unread post by admin »

no worries..
Locked