現在、flask と wtforms を使用して html フォームを作成しようとしています。私の for テンプレートは次のようになります。
<ul><li>Description:</li>
<li> <textarea class="input" rows="10" cols="50" name="description" onKeyDown="limitText(this.form.description,this.form.countdown,150);"
onKeyUp="limitText(this.form.description,this.form.countdown,150);"> 記事の説明。残り文字数です。
私はwtformsを使いたいと思っていました:
<textarea..> with {{form.description}}.
しかし、どうすれば onkeydown イベントを組み込むことができますか? テキストエリアに既に入力されている文字数をカウントするには、それが必要です。
ところで。wtforms を使用して作成したフォームは次のようになります。
class ItemForm(Form):
title = TextField("Title")
subtitle = TextAreaField("Sub Title")
Description = TextAreaField("Description")
offervalue = FloatField("Offer Value")
imagefile_1 = FileField("Image File 1")
imagefile_2 = FileField("Image File 2")
imagefile_3 = FileField("Image File 3")
質問: テキストエリアで発生した場合でも、JAVASCRIPT をどのように含める必要がありますか?
ポインタをありがとう。