Howto set StaticList values from jsx?

Q: How to mix js and velocity code inside jQuery function?

require(['jquery'], function ($) {
var doc = "$escapetool.javascript($request.getParameter('hdwDoc'))";
  
  function switcher(value) {
    var hdwSubType = jQuery('#hdwSubType');
    hdwSubType.hide();
    switch(value) {
      case '0':
        #set($field = doc.getxWikiClass().get("hdwSubType"));
        #set($field.propertyClass.values = "val1|val2|val3");
        hdwSubType.show();
        break;
      default:
    // code block
    }
  }
});

A: Impossible (or not?)

Q: When i try to use AJAX, filling Custom Display property by

{{velocity}}
#if($context.action == 'edit')
  #set($subTypeValues = $request.getParameter('subTypeValues'))
  #set($field.propertyClass.values = $subTypeValues) 
#end
{{/velocity}}

the field becomes inaccessible :frowning:
So, howto dynamically set StaticList values from jsx?

Thanks…

You can have velocity content in a JSX. Velocity is executed first.

I am getting error:
image

Seems logical since this is invalid javascript! What checker is giving you this error?

If you use “parse” to true it should work though unless you have some velocity errors at execution.

Parse is True.
It’s a Chrome console.