javascript filled input not committing

Hi there, This question might not be super mendix related, but I'm doing using it in Mendix and maybe thats why its not working. On a page i pre-fill the value of a few input boxes with cookie values. This works fine but when i click on the button to save it, all those attributes from the pre-filled input boxes are empty   I can fix it by adding 1 simple char before i press the button, then they are correctly filled but this is obviously not the behaviour i want.  I set the value using this simple code;   var name = getCookie("name");   var x = document.getElementsByClassName("RegistreeName");    x[0].childNodes[0].value = name; Anybody knows the solution? Thanks
2 answers

I suggest instead of setting the cookie values into the inputboxes themselves, you set them on the attributes for the specific input boxes. This'll make sure these values get sent to the server once the user presses Save.

See here for information how to set them.

Edit: I figured out a way that doesn't require creating a new custom widget.

You'll need the Javascript Snippet widget.

Simply put that into the page and put in the code you already had, and use this format to write the attributes:

this._contextObj.set('MyAttribute', CookieVal);

The widget's eval is executed within the widget's context, so it has access to the context object!


Hi Hunter,

Based on your information, you could try triggering the onchange event or onleave event of the input box after setting the value. That might properly store the data in the object that is sent to the server when pushing the microflow button.