windows - Input validation Javascript -
in windows 8 javascript app i'm trying validate user's input , keep results on screen after user presses apply using following:
<form> <input id="test" type="number" min="1" max="10" /> <button id="button" type="button">apply</button> </form>
but when click apply validation doesn't work. works if replace type="button"
type="submit"
. problem submit refreshes page , results disappear. can do?
here example of i'm trying do: jsfiddle
update:
i changed code this:
<buton id="button" type="submit" onsubmit="dotest(); return false;">apply</button>
but still refreshes page.
form validation not fire until onsubmit event fires, behavior designed.
one thing set have "onsubmit" event, change button submit type, in onsubmit function call event.stoppropigation stop page doing full postback.
Comments
Post a Comment