Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for type 'password' #115

Open
pmerienne opened this issue Jan 22, 2018 · 1 comment
Open

Support for type 'password' #115

pmerienne opened this issue Jan 22, 2018 · 1 comment

Comments

@pmerienne
Copy link

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.

@hxh-robb
Copy link

hxh-robb commented Jan 25, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants