javascripthtmlvelocitypolarionvelocity-template-language

Trigger Apache Velocity #set Parameter using a button (HTML / JS)


Is it possible to trigger a Velocity Template Language #set value to parameter via a button?

I am trying to combine HTML, JS and Velocity doing the following:

#set($ld=$pageParameters.Work_Item_Link_Direction.values)

<button id="demo2">up</button>

<script>
document.getElementById('demo2').onclick = function() {
   #set( $ld = "up" )
   alert("button2 was clicked");
};
</script> 

The part, however, which doesn't work in this code is:

#set ( $ld = "up")

as it isn't pure JavaScript.

Any hints or ideas how I can combine anyway this "#set value to parameter" as function onclick to the button? I am working inside the application Polarion ALM.

Or is there any other approach how I can set a value to a (page) parameter using velocity and using a Button?


Solution

  • There is a little misconception, here:

    So what you ask for doesn't really make sense.

    What you can do, however, is trigger an ajax call from inside your javascript handler, which can set some value inside the session, return some value to the success ajax handler, etc.