Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAL-Forms feature requests #34

Open
4 of 5 tasks
evert opened this issue Oct 25, 2020 · 3 comments
Open
4 of 5 tasks

HAL-Forms feature requests #34

evert opened this issue Oct 25, 2020 · 3 comments
Assignees

Comments

@evert
Copy link

evert commented Oct 25, 2020

As promised, here's a list of things that I think would be very great to have in HAL-Forms.

If it's more helpful to have these all as separate issues, I'm happy to split these up.

  • a 'target' field in each form. For us, the use of the _htarget= query parameter doesn't make that much sense. URIs are largely treated as opaque, and forms are server-rendered based on other contextual information.
  • Support for a type property in each field, maybe just referencing the HTML5 specification for it's possible values. Also mentioned in different field types #6. It might be helpful to mention what each 'type' serializes to. For example, a checkbox will probably generate a JSON boolean.
  • Support for placeholder, min, max, step, minLength, maxLength
  • Support for an enum or options property. options could be used as follows:
{
  "name": "color",
  "options": {
    "#F00": "red",
    "#0F0": "green",
    "#00F": "blue"
  }
}

I believe all of these could be introduced without breaking backwards compatibility.

If it's helpful, the type Ketting uses to generically describe a field in a hypermedia document is here:

https://github.com/badgateway/ketting/blob/master/src/field.ts

This is how we map a HAL Forms field to Ketting field:

https://github.com/badgateway/ketting/blob/master/src/state/hal.ts#L266

@mamund
Copy link
Owner

mamund commented Dec 6, 2020

@evert

thanks for submitting these -- all good additions.

i'll review the ketting links you provided to help influence the mods.

as you mentioned, i'm going to break this up into individual issues since some will be super easy and others will take a bit of work. the enum one might be compatible with another idea i have been using for another format (called suggest). we can discuss in that issue thread.

thanks again and looking forward to getting these into place.

@evert
Copy link
Author

evert commented Dec 6, 2020

Awesome! Very exited =)

@mamund
Copy link
Owner

mamund commented Dec 18, 2020

adding support for checkbox, radio, and select-options via suggest constuct from #6

note that this might also be a way to deal with enums (see #38)

@mamund mamund self-assigned this Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants