So I have a simple html form with code
div
form action=“” id=“form1”
input type=“submit” value=“Set Output 0”
input type=“hidden” name=‘“Output_0”’ value=“1”
/form
form action=“” id=“form2”
input type=“submit” value=“Reset Output 0”
input type=“hidden” name=‘“Output_0”’ value=“0”
/form
Output 0 : :=“Output_0”: br
input id=“btn1” type=“button” name=‘“Output_0”’ value=“1”
input id=“btn2” type=“button” name=‘“Output_0”’ value=“0”
input id=“btn3” type=“button” name=‘“Output_0”’ onclick=“Output_0= 0;”
/div
And I’m using the holographic button demo
and there’s this documentation from stackoverflow about how to make a form not reload the page
using jquery referenced in method 2.
The issue I’m having is that in order to get the buttons to execute the form functionalities
I have to put the code like this
button.onPointerClickObservable.add(function () {
if (output == 0) {
document.getElementById(“form1”).submit();
output = 1;
} else {document.getElementById(“form2”).submit();
output = 0;
}
button.text = "Clicks: " + output;return false;
});
The issue is that it causes the page to reload.
Can anyone figure this out?