Wicket Form作成中に以下のエラーが発生しました。
備忘録としてメモします。

<input type="text" ....></input><input type="email" ....></input>食い違いによるエラー

must be applied to a tag with [type] attribute matching any of [text], not [email]

原因は、<input type="”email”" ...>TextFieldadd しているために発生していました。

  • 修正前

        // eMail
        TextField eMail = new RequiredTextField("eMail", Model.of(""));
        eMail.add(StringValidator.maximumLength(150));
        eMail.add(EmailAddressValidator.getInstance());
        form.add(eMail);
    

  • 修正後

        // eMail
        EmailTextField eMail = new EmailTextField("eMail", Model.of(""));
        eMail.setRequired(true);
        eMail.add(EmailAddressValidator.getInstance());
        eMail.add(StringValidator.maximumLength(150));
        form.add(eMail);
    

上記の記述後に、ChromeJavascriptエラーが発生しました。

Uncaught InvalidStateError: Failed to read the 'selectionStart' property from 'HTMLInputElement': The input element's type ('email') does not support selection.

上記、エラーのため以下の通り、記述しました。 <input type="”text”" ...>にして、TextFieldaddする。

  • 修正前

        // eMail
        EmailTextField eMail = new EmailTextField("eMail", Model.of(""));
        eMail.setRequired(true);
        eMail.add(EmailAddressValidator.getInstance());
        eMail.add(StringValidator.maximumLength(150));
        form.add(eMail);
    

  • 修正

        // eMail
        TextField eMail = new RequiredTextField("eMail", Model.of(""));
        eMail.add(StringValidator.maximumLength(150));
        eMail.add(EmailAddressValidator.getInstance());
        form.add(eMail);
    

Chromeエラーは解決方法あるかもしれないです。
じゃないと、<input type="”email”" ...>が使えない。ということに。。
以上です。

コメント