Last active
August 29, 2015 14:20
-
-
Save cscartjp/77996768a2c4c8865af7 to your computer and use it in GitHub Desktop.
CS-Cart(管理画面) 独自のフォームバリデータを定義する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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