Is there any [dis]advantage to using "button/click ID" over "input submit/submit form"?


#1

I’m successfully saving Documents into Collections using both this methodology:

HTML:

<button id="btnSaveJobLoc" name="btnSaveJobLoc" type="button">Save Job/Location</button>

JS:

  'click #btnSaveJobLoc': function(event, template) {

…and this:

HTML:

 <input id="insertWorker" name="insertWorker" type="submit" value="Save Worker">

JS:

‘submit form’: function(event, template) {

I have many more to do yet, and just tried both ways to see if they would both work the same; they seem so, but before I just randomly select one way over the other, does anybody know if there are any [dis]advantages either way?

BTW: I though "three grave accents and a language name, such as: “```html” were supposed to format the code nicely, but I guess I’m remembering it wrong, as that’s not working above…


#2

If you use the submit event, then you can preserve the native browser functionality for submitting forms… for example, hitting enter when in an input text box. (login form for example)

(to display code, indent with 4 spaces, or just hightlight the paragraph and click the </> button)