json-forms
json-forms copied to clipboard
Support for type 'password'
I think it could be really good to add support of a 'password.
I'm not a good JS developper so I'm having troubles to create a nice PR for this feature. Thus I can't provide any help with this issue.
Seems like it isn't a native support. You can have a look at issue #97 , but we can use "decorator" to meet this requirement.
Please check out this example. https://jsfiddle.net/hxh_robb/xk663z01/4/
// add support for password and file fields
BrutusinForms.addDecorator(function(element, schema) {
if (element.tagName) {
var tagName = element.tagName.toLowerCase();
if (tagName === "input" && schema.type === "string") {
if( schema.format === 'inputstream' || schema.format === 'file' ){
element.type = 'file';
} else if ( schema.format === 'password' ){
element.type = 'password';
}
}
}
});
Hope this help.