How to dynamically change a label on a control?

Hi All,

Having a seniors moment here.

I have a control app which has a checkbox field and two related integer fields. One of these integer fileds is hidden until the checkbox is checked.

If the checkbox is checked the two fileds are displayed.

The problem is that I wish to change the text shown in the label of one of the integer fields, and revert is back to it’s orginal text if it is not checked.

So, I have the hide on/off sorted, but I cannot get the text of the label to change.

I tried sc_label in just about all events including ajax but I cannot get the text to change.

Anyone Help?

Thanks

Tony

found a solution already?

Add an event of type ‘onClick’ on the checkbox field (menu ‘Form Settings’ -> ‘JavaScript’ -> select the field and the ‘onClick’ event and then click ‘Edit’) and there you can set the new label using JavaScript:


var newLabel = "new label test";
$("#id_label_HERE-YOU-PUT-THE-FIELD-NAME").text(newLabel);

ps: id_label_HERE-YOU-PUT-THE-FIELD-NAME should be changed to your field name, e.g.
$("#id_label_name")
$("#id_label_age")
$("#id_label_country")

This faq shows you how to dynamically change color. I think this method could be used as text is also a property. But it will require some modification.

http://scriptcase.aducom.com/cms/e10…php?0.cat.6.7

Related to this, how do I change the Title of a tab application dynamically ? I have tried using a global variable … didn’t work, there aren’t any events in a tab application to work with…

Here too you need to apply javascript. These things aren’t changed easily, I try to avoid javascript as much if I can. But if you are technical enough you can dive into the generated html and find the name of the objects.

Look like the global variable issue in Tabs has been addressed in release SCRIPTCASE V8.1.048. Coincidence ? :slight_smile: