今天遇到了个小问题,console里没有报错,但是表单不能提交,猜测是验证的问题,后来跟PP确认了下.
+ validate_virtual_name_exists = (value, element) ->+ result = value != null && value != ''+ return result++ $.validator.addMethod("validate_virtual_name_exists", validate_virtual_name_exists ,+ "请选择虚名称");++ validate_form( 'form', {+ ignore: ":hidden:not(#plan_website_virtual_name)"+ debug:+ true+ rules:+ 'schedule_type_cron_value': 'required'+ 'schedule_type' : 'required'+ 'plan[website_virtual_name]':+ validate_virtual_name_exists: true+ })
+ ignore: ":hidden:not(#plan_website_virtual_name)"
这句话的意思是就算这个id为plan_website_virtual_name的元素被隐藏了也需要非空,好凶残.