防止wtform在手机上自动大写

时间:2019-01-25 21:04:35

标签: html flask mobile flask-wtforms wtforms

在我的Web表单中由移动设备键入的用户输入总是自动将我不想出现的第一个字符大写。我发现here看到在html中手动指定输入字段时,您可以声明输入不应自动大写为:

import {
  ExecutionContext,
  Injectable,
  mixin,
  NestInterceptor,
} from '@nestjs/common';
import { Observable } from 'rxjs';
import { TestService } from './test/test.service';

@Injectable()
export abstract class CacheInterceptor implements NestInterceptor {
  protected abstract readonly cacheDuration: number;

  constructor(private readonly testService: TestService) {}

  intercept(
    context: ExecutionContext,
    call$: Observable<any>,
  ): Observable<any> {
    // Whatever your logic needs to be

    return call$;
  }
}

export const makeCacheInterceptor = (cacheDuration: number) =>
  mixin(
    // tslint:disable-next-line:max-classes-per-file
    class extends CacheInterceptor {
      protected readonly cacheDuration = cacheDuration;
    },
  );

但是我在表单输入中使用@Injectable() class UserService{ @UseInterceptors(makeCacheInterceptor(1000)) async getUser(id:string):Promise<User>{ // Make a call to db to get all Users } } ,但是没有这种级别的控制。我的表单规范如下:

<input type="text" name="username" id="username"
    class="form-control" placeholder="Enter your user name" 
    value="" 
    autocapitalize="off" 
    autocomplete="off"
    spellcheck="false" 
    autocorrect="off"   />

html看起来像这样:

flask-wtforms

是否可以通过某种方式使class InputWords(FlaskForm): word1 = StringField('Word 1', validators=[DataRequired()]) word2 = StringField('Word 2', validators=[DataRequired()]) 停止在移动设备上自动对用户输入进行大写?

0 个答案:

没有答案