How can i get the value after the on Change for the dropdownlist without Model


i have tried everthing to get the new Value in OnChange event for a dropdown list without model. but i get always NOTHING

$ls_sku_field->onChange( function($val) use ($ls_stock_form){
$lv_value = $val;

        //return 'hallo';
      //  $args = $args;            
      //  $lv_form = $ls_stock_form;
      //  return 'hallo';

Did i some mistake ? can someone post a solution ?


Did you get your callback code called at all?

i have tried every thing. The callback was be called. I can see it wit breakpoint. But i do not know, how can I get the value :frowning:


I seem to not understand what are you trying to do. But in an onChange event I think you have to return a js to be executed

hi Zak,
thanks for your answer.
i want to only catch the new value from dropdownlist if i select an entry.
an example from w3school

  Select your favorite fruit:
  <select id="mySelect">
    <option value="apple">Apple</option>
    <option value="orange">Orange</option>
    <option value="pineapple">Pineapple</option>
    <option value="banana">Banana</option>

<p>Click the button to return the value of the selected fruit.</p>

<button type="button" onclick="myFunction()">Try it</button>

<p id="demo"></p>

function myFunction() {
  var x = document.getElementById("mySelect").value;
  document.getElementById("demo").innerHTML = x;



Hello again Peter.

If I understand your scenario correctly you might want to try two things:


To get the value in a js callback



If you are in the form’s on submit callback.

Hello Zak,

sorry for the later answer.
in the end, i have put the dropdown into a form and i get the value at last :slight_smile:

thx for your help


1 Like

You’re welcome Peter