-1

Is there a custom element, which allow the use of RFC6570 URI templates? This is very similar to this question. Here's the sample HTML used there.

<form action="/orders/{id}" method="get">
   <input type="text" name="id"/>
   <input type="submit" value="Submit"/>
</form>

I'm asking specifically about a Web Component though, so something like either

<form is="templated-form">

or

<templated-form>
Community
  • 1
  • 1
Tomasz Pluskiewicz
  • 3,622
  • 1
  • 19
  • 42

1 Answers1

0

It's very simple to create if it doesn't exist yet.

Just register a <template-form> custom element inheriting from HTMLFormElement.prototype, and extending the form element, that will make use of your favorite RFC6570 URI templates compliant JavaScript library.

For example, this one : https://medialize.github.io/URI.js/uri-template.html, or those ones : https://github.com/medialize/URI.js/#uri-template.

You'll have to use the extended notation in order to take advantage of the semantics of the <form> element :

<form is="template-form"> 
Supersharp
  • 29,002
  • 9
  • 92
  • 134