Skip to content Skip to sidebar Skip to footer

Name Field Not Set For Form Input Fields

I have a form and it contains multiple input fields. What if i don't provide an id or name to each and every field. will that field be submitted with some default name or won't be

Solution 1:

Form controls without names cannot be successful controls and will not be submitted.

The value of a control without a name will not be included in the submitted form data.

See HTML 4:

A successful control is "valid" for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.

or HTML 5:

If any of the following conditions are met, then skip these substeps for this element … The field element is not an input element whose type attribute is in the Image Button state, and either the field element does not have a name attribute specified, or its name attribute's value is the empty string.


The id is irrelevant to the success of a control. Only the name matters there.

The id is still important to include as it is the best way to associate a <label> element with a control (and has other uses via JS and CSS).

Solution 2:

The form will still get submitted but you won't be able to get the 'post' values when the form has been submitted.

Post a Comment for "Name Field Not Set For Form Input Fields"