0

ユーザーにとってより意味のあるラベルをオーバーライドしようとしている単純な SQLform があります。

form = SQLFORM(db.UserData, submit_button='Report now !', labels = {'title':'Article Title', 'link':'Link to article', 'htmlcontent':'HTML 形式のコンテンツ', ' textcontent':'Content in text format', 'source':'Your name', 'imageurl':'Image to the article', 'briefdescription':'Brief article excerpt', 'iscontentavailable': 'Ignore this'})

htmlContentimageurl 、 briefdescriptiontextcontentのラベルは置き換えられません。

何をチェックすべきか、どこが間違っているのか、何か考えはありますか?

4

1 に答える 1

2

テーブルを定義するときに、ラベルを使用してフィールドに簡単な名前を付けることができます。

db.define_table('system',
            Field('version', label='System Version', length=4),
            Field('db', label='System Database', length=10),
            Field('modules', label='Modules loaded', length=50)
            )

カスタム フォームでプレースホルダー HTML5 プロパティを使用すると、テキスト ボックスにヒントを入力できます。

{{=form.custom.begin}}
{{form.custom.widget.title['_placeholder']='Article Title'}}
{{form.custom.widget.link['_placeholder']='Link to article'}}
....
{{=form.custom.end}}

ラベルを追加するには、jquery を使用できます。

$('#title').val($('#title').val() + 'Article Title');
于 2013-01-25T16:00:38.677 に答える