SubmitClickHandle() that performs the form submission. If you use
type="submit", then the form also submits using the default method, which reloads the page and cancels the
You should use
If you want to use
onclick code should end with
return false to prevent the default action:
<button type="submit" onclick="SubmitClickHandle(); return false">
Submit buttons trigger the submission of a form (and when they do, their
value are included in the submitted form data).
Button buttons don’t.
When I use type=”button” then it submits successfully but type=”Submit” does not? why is that?
Presumably, because your idea of “submits successfully” doesn’t involve performing a normal form submission but instead means “Executes the
SubmitClickHandle() function without leaving the page”.
type="Button" in element input. How are they different? When I use
type="button" then it submits successfully but
type="Submit" does not? why is that?
<input class="name" type="text" name="name" required />
<input class="address" type="text" name="address" required />
<button onclick="closeDialog()">Close Dialog</button>
Good. What i need to do when i use both type=”submit” and form?
Right. And that’s the problem he’s having — the two submissions are conflicting with each other.