json-forms icon indicating copy to clipboard operation
json-forms copied to clipboard

Support for type 'password'

Open pmerienne opened this issue 7 years ago • 1 comments

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.

pmerienne avatar Jan 22 '18 13:01 pmerienne

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.

hxh-robb avatar Jan 25 '18 03:01 hxh-robb