Skip to content

Instantly share code, notes, and snippets.

@cscartjp
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cscartjp/77996768a2c4c8865af7 to your computer and use it in GitHub Desktop.
Save cscartjp/77996768a2c4c8865af7 to your computer and use it in GitHub Desktop.
CS-Cart(管理画面) 独自のフォームバリデータを定義する
<!-- 5文字以内かどうか -->
<div class="control-group cm-no-hide-input">
<label for="product_max5" class="control-label cm-required cm-check-max5">{__("product_max5_title")}</label>
<div class="controls">
<input id="product_max5" class="input-long" type="text" name="product_data[product_max5h]" size="55" value="{$product_data.product_max5h}" />
</div>
</div>
<script type="text/javascript">
//<![CDATA[
//独自バリデータを実装する
//最大文字数5かどうかチェックする
Tygh.$.ceFormValidator('registerValidator', {
class_name: 'cm-check-max5',
message: '{__("check_over_max5")|escape:javascript}',
func: function(id) {
if($('#' + id).val().length > 6){
return false;
}else{
return true;
}
}
});
//]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment