Skip to content

Instantly share code, notes, and snippets.

@atsu666
Created October 31, 2012 04:54
Show Gist options
  • Save atsu666/3984853 to your computer and use it in GitHub Desktop.
Save atsu666/3984853 to your computer and use it in GitHub Desktop.
#a-blog cms カスタムフィールドグループのバリデーションサンプル
<h1>カスタムフィールドグループ demo</h1>
<table class="js-fieldgroup-sortable">
<tr>
<td><input type="button" class="item-insert" value="追加" /></td>
<td>日付</td>
<td>メールアドレス</td>
<td>削除</td>
</tr>
<!-- BEGIN sampleGroup:loop -->
<tr class="sortable-item">
<td class="item-handle">移動</td>
<td>
<input type="text" name="sampleDate[{i}]" value="{sampleDate}" class="js-datepicker" />
</td>
<td>
<input type="text" name="sampleText[{i}]" value="{sampleText}" />
</td>
<td><input type="button" class="item-delete" value="削除" /></td>
</tr>
<!-- END sampleGroup:loop -->
<tr class="sortable-item item-template">
<td class="item-handle">移動</td>
<td><input type="text" name="sampleDate[]" class="js-datepicker" value="" /></td>
<td>
<input type="text" name="sampleText[]" value="" />
</td>
<td><input type="button" class="item-delete" value="削除" /></td>
</tr>
</table>
<input type="hidden" name="sampleText:v#required" />
<input type="hidden" name="sampleText:v#email" />
<!-- BEGIN sampleText:validator#required -->メールアドレスを最低一つ入力して下さい<!-- END sampleText:validator#required -->
<!-- BEGIN sampleText:validator#email -->メールアドレスを入力して下さい<!-- END sampleText:validator#email -->
<input type="hidden" name="field[]" value="sampleDate" />
<input type="hidden" name="field[]" value="sampleText" />
<input type="hidden" name="field[]" value="@sampleGroup" />
<input type="hidden" name="@sampleGroup[]" value="sampleDate" />
<input type="hidden" name="@sampleGroup[]" value="sampleText" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment