Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available 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: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

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: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Conditional Formatting

Unread post by admin »

no worries..
Locked