Search code examples
javascriptgenexus

Javascript variable and Web Panel Variable


How do I make the link between the javascript variables and the Web Panel variables?

I have a User Control, and I want to passe the value of a javascript variable to a web panel variable, but I don't know where and how I make that attribution.


Solution

  • You should use a property of the user control for that.

    User control's properties are easily set by asigning a value in your Javascript code. For example:

    // UC Javascript code - Asigning MyProperty property
    this.show = function () {
        var myVar = 1;
        this.MyProperty = myVar;
    };
    

    Then, you can read the value of the property in your GX code:

    // GeneXus code - shows a message with "1"
    Event Enter
        &MyGxVar = MyUserControl.MyProperty
        msg(&MyGxVar)
    EndEvent