TopMovable Typeカスタムフィールド > コメント用カスタムフィールドの投稿フォームのカスタマイズ(その2)
2010年5月 5日

コメント用カスタムフィールドの投稿フォームのカスタマイズ(その2)

Posted at May 5,2010 11:55 PM
Category:[カスタムフィールド]
Tag:[, ]

コメント用カスタムフィールドの投稿フォームのカスタマイズ(その1)」の続きです。

Includeタグで呼び出しているフォームフィールド(グローバルテンプレート)の内容は、次の通りです。

<div id="<$mt:Var name="id"$>-field" class="field-top-label field pkg <$mt:Var name="class"$>">
  <div class="field-inner">
    <div class="field-header">
      <label type="text" id="<$mt:Var name="id"$>-label" for="<$mt:Var name="id"$>"><$mt:Var name="label"$><mt:If name="required"> *</mt:If></label>
    </div>
    <div class="field-content ">
      <$mt:Var name="field-content"$>
    </div>
  </div>
</div>

この中で、変数requiredを判定しています(青色部分)が、テンプレートタグリファレンスのMTCommentCustomFieldsでは、コメント投稿フォームへのカスタムフィールドの設定に変数requiredが引き継がれていません(下)。

<input type="hidden" name="blog_id" value="<MTBlogID>" />
<input type="hidden" name="customfield_beacon" value="1" id="customfield_beacon" />
<mt:CommentCustomFields>
  <mt:SetVarBlock name="custom_field_name"><$mt:CustomFieldName$></mt:SetVarBlock>
  <mt:SetVarBlock name="field-content"><$mt:CustomFieldHTML$></mt:SetVarBlock>
  <mt:SetVarBlock name="custom_field_id">profile_<$mt:CustomFieldName dirify="1"$></mt:SetVarBlock>
<$mt:Include module="フォームフィールド" id="$custom_field_id" class="" label="$custom_field_name"$>
</mt:CommentCustomFields>

変数requiredを引き継ぐには、「コメント用カスタムフィールドの投稿フォームのカスタマイズ(その1)」の修正後のサブテンプレートに、青色の変更を加えると良いでしょう。

<input type="hidden" name="blog_id" value="<MTBlogID>" />
<input type="hidden" name="customfield_beacon" value="1" id="customfield_beacon" />
<mt:CommentCustomFields>
  <mt:SetVarBlock name="custom_field_name"><$mt:CustomFieldName$></mt:SetVarBlock>
  <mt:SetVarBlock name="field-content"><$mt:CustomFieldHTML$></mt:SetVarBlock>
  <mt:SetVarBlock name="custom_field_id">customfield_<$mt:CustomFieldBasename$></mt:SetVarBlock>
  <mt:SetVarBlock name="required"><mt:CustomFieldIsRequired>1<mt:Else>0</mt:CustomFieldIsRequired></mt:SetVarBlock>
  <$mt:Include module="フォームフィールド" id="$custom_field_id" class="" label="$custom_field_name"$>
</mt:CommentCustomFields>
Posted by yujiro   このページの先頭に戻る
関連記事
この記事を読んだ人はこんな記事も読んでいます
人気エントリー
Hatena Hot Entries
Hatena Entries
トラックバックURL


コメントする
greeting

*必須

*必須(非表示)


ご質問のコメントの回答については、内容あるいは多忙の場合、1週間以上かかる場合があります。また、すべてのご質問にはお答えできない可能性があります。予めご了承ください。

太字 イタリック アンダーライン ハイパーリンク 引用
[サインインしない場合はここにCAPTCHAを表示します]

コメント投稿後にScript Errorや500エラーが表示された場合は、すぐに再送信せず、ブラウザの「戻る」ボタンで一旦エントリーのページに戻り(プレビュー画面で投稿した場合は、投稿内容をマウスコピーしてからエントリーのページに戻り)、ブラウザをリロードして投稿コメントが反映されていることを確認してください。

コメント欄に(X)HTMLタグやMTタグを記述される場合、「<」は「&lt;」、「>」は「&gt;」と入力してください。例えば「<$MTBlogURL$>」は「&lt;$MTBlogURL$&gt;」となります(全て半角文字)

Now loading...
Introduction
Entries of this Category
Recent Entries
Recent Comments
Recent Trackbacks
QRcode

現在停止中です
携帯電話からこのQRcodeを撮影することで携帯用URLを取得することができます

URI for cellular phones
ギターに入った猫
Styles
Font Size
Default
For defective color vision
Gray Scale
RGB Color
Search this site

このブログをメールで購読する by:FeedBurner

loading ...
Categories
Monthly Archives
BlogPeople
Syndicate this site
FeedBurner(RSS1.0/RSS2.0/Atom)
Counter
これまでのアクセス
クリエイティブ・コモンズ・ライセンス
Powered by
Movable Type 5.12