sweh / ajja

JavaScript library for simple creation of forms and display of collections
MIT License
2 stars 0 forks source link

Also allow registration of templates using the #id (preferred over registration by type) #53

Open florianpilz opened 8 years ago

florianpilz commented 8 years ago

Say I have a multiple forms which also require the user to input a credit card. Thus I made a template for credit cards, which consists of 4 Input fields side-by-side (since a credit card has 4 groups with 4 numbers each).

The type of the input field is a string, so the default template is just a single input field. To use my special template for credit cards, I currently have to explicitly declare the usage for every form. But since it is the same concept in all forms, I made sure the field is always named credit_card. Thus in all forms the credit card field has the id field-credit_card.

It would be great if I could register the template in a way, that it is automatically used for every field that is named field-credit_card, no matter which type this field has. (Of course, declaring another template in the form options will override the global registration by field name).