Skip to content

Inputs should have name attributes #2142

Open
@Altair-Bueno

Description

@Altair-Bueno

Is your feature request related to a problem? Please describe.

The name attribute is essential for server first websites that leverage traditional form submission workflows. Consider the following React component and scheme:

function BasicForm (props){
   return <form action={props.action} method={props.method}>
      <JsonForms
        renderers={vanillaRenderers}
        cells={vanillaCells}
        {...props}
      />
      <input type="submit" />
    </form>
}
{
  "title": "Person",
  "required": ["name", "surname", "birthday"],
  "type": "object",
  "properties": {
    "name": { "title": "Name", "type": "string" },
    "surname": { "title": "Surname", "type": "string" },
    "birthday": { "title": "Birthday", "type": "string", "format": "date" }
  }
}

This renders successfully but name attributes are nowhere to be seen

image
<form action="/createPerson" method="POST">
  <div class="vertical-layout">
    <div class="vertical-layout-item">
      <div class="control root_properties_name" id="#/properties/name">
        <label for="#/properties/name-input" class="">Name*</label
        ><input
          type="text"
          class="validate valid input"
          id="#/properties/name-input"
          value=""
        />
        <div class="validation input-description"></div>
      </div>
    </div>
    <div class="vertical-layout-item">
      <div class="control root_properties_surname" id="#/properties/surname">
        <label for="#/properties/surname-input" class="">Surname*</label
        ><input
          type="text"
          class="validate valid input"
          id="#/properties/surname-input"
          value=""
        />
        <div class="validation input-description"></div>
      </div>
    </div>
    <div class="vertical-layout-item">
      <div class="control root_properties_birthday" id="#/properties/birthday">
        <label for="#/properties/birthday-input" class="">Birthday*</label
        ><input
          type="date"
          class="validate valid input"
          id="#/properties/birthday-input"
          value=""
        />
        <div class="validation input-description"></div>
      </div>
    </div>
  </div>
  <input type="submit" />
</form>

Without name attributes, submitting the form sends nothing.

Describe the solution you'd like

Include name attributes on each input field.

Describe alternatives you've considered

  • Writing my own forms, which is exactly what I don't want to do.
  • Manually handling forms on client side, which is a waste of client resources and time.

Framework

Core

RendererSet

Vanilla

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions