AnsweredAssumed Answered

toggle button change and pass a variable

Question asked by BLomas on Jun 29, 2018
Latest reply on Jul 2, 2018 by rscheitlin

I'm new to javascript so I'm hoping you can help me along. I'm working on a widget that has a getlocation function loop running at startup. My hope is to have this toggle button be able to change a variable and send it to another function. I'm having trouble getting the variable to be passed into function c below. Ultimately the message is sent via POST. The code below is the basics of what I'm trying to do. The actual code is very long but I think you can get the idea from the snippet. Thanks.

 

begin: function a(){
     var variable = this.variable
     
     new ToggleButton({
          onchange: function{
               if val(){
                    label x
                    this.variable = x
               }else{
                    label y
                    this.variable =y
               }
          }
     }, "button id").startup();

     function b(){
          function c(){
               message = ("..."+ this.variable + "...")
          }
     }
     
}

Outcomes