2

次の方法で、( jQuery Validation Engineを使用して)時間を入力するフィールドを検証するカスタム検証を追加する際に問題が発生します。hh:mm(例:12:30);

私の知る限り、以下を追加する必要があります

"timeFormat":{ 
    "regex":"/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/",
    "alertText":" errormessage in the locale chosen"}                           
}

jquery.validationEngine-(the locale).js

入力フィールドに以下を追加しますclass="validate[custom[timeFormat]]"

しかし、何らかの理由で機能しません。入力した内容が何であれ、フィールドが無効であることが表示されます。正規表現に問題があると思われますが、http: //gskinner.com/RegExr/でテストしたところ、かなり問題ないようです。

提案?

4

1 に答える 1

1

You don't need the quotes around your regex. Try this here:

"timeFormat":{
    "regex": /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/,
    "alertText":" errormessage in the locale chosen"                           
}
于 2011-11-28T13:33:22.987 に答える