Announcement

Collapse
No announcement yet.

How to dynamically change a label on a control?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    found a solution already?

    Comment


    • #3
      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:

      Code:
      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")
      SC Tools: A browser extension to make working with ScriptCase simpler and even more productive.

      http://blog.andersonmamede.com.br

      Comment


      • #4
        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
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          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...

          Comment


          • #6
            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.
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development
            www.scriptcase.eu / www.scriptcase.nl

            Comment


            • #7
              Look like the global variable issue in Tabs has been addressed in release SCRIPTCASE V8.1.048. Coincidence ?

              Comment

              Working...
              X