naja-js/naja

Submitter should be left out from data if its name is empty

jiripudil opened this issue · 3 comments

Bug Report

As reported on Nette Forum, Naja adds the submitter to the form data even if it has an empty name. According to the HTML spec, fields with an empty name should be omitted from the data set though.

I can do this.

Sure, go ahead, thank you!

Essentially it should suffice to

  • add element.name !== '' to the condition (while you're at it, I think the || element.tagName === 'BUTTON' part is a bug too and should be removed), and
  • update the element.type === 'image' branch so that it appends just x and y without the dot if element.name === ''.

Noted 👍