zoukankan      html  css  js  c++  java
  • 便利的html5 之 required、number 、pattern

    html5对于表单验证提供了很多自识别功能,非常的便利。

    看代码,

    <!--head start-->
    <include file="Public:head" />
    <!-- style here  -->
    <!--head end -->
    <section class="panel">
        <div class="panel-body">
            <form role="form" id="myform" method="post" enctype="multipart/form-data">
                <input type="hidden" name="id" value="{$info.id}">
                <div class="form-group">
                    <label for="">名称</label>
                    <input type="text" name="name" class="form-control" id="name" placeholder="" value="{$info.name}" required>
                </div>
    
                <div class="form-group">
                    <label for="">排序(数字大靠前)</label>
                    <input type="number" name="sort" value="{$info.sort}" class="form-control" id="sort" placeholder="" required>
                </div>
    
                <div class="form-group">
                    <label for="">拼音/英文</label>
                    <input type="text" name="spell" class="form-control" id="spell" placeholder="" value="{$info.spell}" pattern="^[a-zA-Z]+$" required>
                </div>
                <button type="submit" class="btn btn-info">提交</button>
            </form>
        </div>
    </section>
    <!--foot start-->
    <include file="Public:foot" />
    <!--foot end -->
    <!-- script here  -->
    <script>
    var index = parent.layer.getFrameIndex(window.name);
    var handle_status = '{$handle_status}';
    if ( handle_status == '1' ) {
        parent.$("#handle_status").val('1');
        parent.layer.close(index);
    } else if ( handle_status == '2' ) {
        parent.$("#handle_status").val('2');
        parent.layer.close(index);
    }
    
    </script>
    
    

    看效果,

  • 相关阅读:
    check2
    LYF模板连接.txt
    mvc中的表现和数据分离怎么理解?
    node中websocket的使用
    vue随笔
    python安装Django常见错误
    node中的session的使用
    为什么很多IT公司不喜欢进过培训机构的人呢
    vue数据交互
    vuecli的服务代理
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/5462751.html
Copyright © 2011-2022 走看看