I am creating with a mouse event two float values in a javascipt jquery function and pass these values via form to a spring mvc controller as parameters. It works fine when the values get actually created but when I do not create them, the form passes a string "undefined" and the whole thing crashes.
my javascript values:
$('#width').val(event.pageX);
$('#height').val(event.pageY);
my form:
<form:form modelAttribute="Float2" method="POST" action="getFloats">
<input type="hidden" id="width" name="width" value=width>
<input type="hidden" id="height" name="height" value=height>
<button type="submit">Save the floats</button>
Is there a possibility to change the "undefined" to zero so that the form always passes floats?