Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Uses uritemplate-js and jQuery to process uri templates in html form actions

License

Notifications You must be signed in to change notification settings

themotleyfool/formtemplate-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This library combines uritemplate-js with jQuery to process RFC 6570 URI Templates before the form is submitted.

In other words, when this library is loaded, given this form:

<form action="/api/users/{username}" method="GET">
    <label>
        username
        <input name="username" type="text" value="example">
    </label>
    <input type="submit">
</form>

The action will be updated to /api/users/example when the form is submitted.

Build

To build, install the requirejs optimizer node package:

npm install requirejs

Then:

r.js -o build.js

When To Use It

If you have an api that uses templated routes, this can help you write forms that test the routes.

Why You Should Not Use It

It breaks the web. URI Templates are not part of any html standard. User agents that do not enable javascript will not work. It does not degrade gracefully.

Caveat emptor.

About

Uses uritemplate-js and jQuery to process uri templates in html form actions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published