{template "header.html"}



<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {dr_form_hidden()}
    <div class="row myfbody">
        <div class="col-md-12">

            <div class="portlet light bordered">

                <div class="portlet-body form">

                    <div class="form-body">



                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('测试文字')}</label>
                            <div class="col-md-9">
                                <textarea name="data[text]" class="form-control" style="height:100px; width:100%;"></textarea>
                                <p class="help-block"> {dr_lang('填写需要测试验证的文字')} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('正则表达式')}</label>
                            <div class="col-md-9">
                                <textarea name="data[code]" class="form-control" style="height:100px; width:100%;"></textarea>
                                <p class="help-block"> {dr_lang('填写正则表达式代码，例如纯数字写法为：%s', '/^[0-9]+$/')} </p>
                            </div>
                        </div>


                    </div>
                </div>
            </div>


        </div>

    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_test_pattern()" class="btn green"> <i class="fa fa-send"></i> {dr_lang('立即测试')}</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    function dr_test_pattern() {
        var loading = layer.load(2, {
            shade: [0.3,'#fff'], //0.1透明度的白色背景
            time: 100000000
        });
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "{dr_now_url()}",
            data: $("#myform").serialize(),
            success: function(json) {
                layer.close(loading);
                if (json.code) {
                    dr_cmf_tips(1, json.msg, json.data.time);
                } else {
                    dr_cmf_tips(0, json.msg, json.data.time);
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
            }
        });
    }
</script>
{template "footer.html"}