17 Star 128 Fork 33

笔下光年/Light Year Admin v5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lyear_forms_validation.html 64.13 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2022-11-06 18:42 . 上传新项目文件
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>验证 - 光年(Light Year Admin V5)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.min.css">
</head>
<body>
<!--页面loading-->
<div id="lyear-preloader" class="loading">
<div class="ctn-preloader">
<div class="round_spinner">
<div class="spinner"></div>
<img src="images/loading-logo.png" alt="">
</div>
</div>
</div>
<!--页面loading end-->
<div class="lyear-layout-web">
<div class="lyear-layout-container">
<!--左侧导航-->
<aside class="lyear-layout-sidebar">
<!-- logo -->
<div id="logo" class="sidebar-header">
<a href="index.html"><img src="images/logo-sidebar.png" title="LightYear" alt="LightYear" /></a>
</div>
<div class="lyear-layout-sidebar-info lyear-scroll">
<nav class="sidebar-main">
<ul class="nav-drawer">
<li class="nav-item">
<a href="index.html">
<i class="mdi mdi-home-city-outline"></i>
<span>后台首页</span>
</a>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-television-guide"></i>
<span>布局</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_layout_break_point.html">拐点</a> </li>
<li> <a href="lyear_layout_containers.html">容器</a> </li>
<li> <a href="lyear_layout_grid.html">栅格</a> </li>
<li> <a href="lyear_layout_columns.html"></a> </li>
<li> <a href="lyear_layout_gutters.html">沟槽</a> </li>
<li> <a href="lyear_layout_utilities.html">实用程序</a> </li>
<li> <a href="lyear_layout_zindex.html">Z-index</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-silo"></i>
<span>页面内容</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_content_typography.html">排版</a> </li>
<li> <a href="lyear_content_images.html">图片</a> </li>
<li> <a href="lyear_content_tables.html">表格</a> </li>
<li> <a href="lyear_content_figures.html">画像</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav active open">
<a href="javascript:void(0)">
<i class="mdi mdi-map-outline"></i>
<span>表单</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_forms_overview.html">概述</a> </li>
<li> <a href="lyear_forms_control.html">表单控件</a> </li>
<li> <a href="lyear_forms_select.html">下拉选择</a> </li>
<li> <a href="lyear_forms_radio.html">单选框</a> </li>
<li> <a href="lyear_forms_checkbox.html">复选框</a> </li>
<li> <a href="lyear_forms_switch.html">开关</a> </li>
<li> <a href="lyear_forms_range.html">范围</a> </li>
<li> <a href="lyear_forms_input_group.html">输入组</a> </li>
<li> <a href="lyear_forms_floating_labels.html">浮动标签</a> </li>
<li> <a href="lyear_forms_layout.html">布局</a> </li>
<li class="active"> <a href="lyear_forms_validation.html">验证</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-tune"></i>
<span>组件</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_components_accordion.html">手风琴菜单</a> </li>
<li> <a href="lyear_components_alerts.html">警告框</a> </li>
<li> <a href="lyear_components_badge.html">徽章</a> </li>
<li> <a href="lyear_components_breadcrumb.html">面包屑导航</a> </li>
<li> <a href="lyear_components_buttons.html">按钮</a> </li>
<li> <a href="lyear_components_button_group.html">按钮组</a> </li>
<li> <a href="lyear_components_card.html">卡片</a> </li>
<li> <a href="lyear_components_carousel.html">轮播</a> </li>
<li> <a href="lyear_components_close_button.html">关闭按钮</a> </li>
<li> <a href="lyear_components_collapse.html">折叠</a> </li>
<li> <a href="lyear_components_dropdowns.html">下拉菜单</a> </li>
<li> <a href="lyear_components_list_group.html">列表组</a> </li>
<li> <a href="lyear_components_modal.html">模态框</a> </li>
<li> <a href="lyear_components_navs_tabs.html">导航 &amp; 标签页</a> </li>
<li> <a href="lyear_components_navbar.html">导航栏</a> </li>
<li> <a href="lyear_components_offcanvas.html">滑动容器</a> </li>
<li> <a href="lyear_components_pagination.html">分页</a> </li>
<li> <a href="lyear_components_placeholders.html">占位符</a> </li>
<li> <a href="lyear_components_popovers.html">POP提示</a> </li>
<li> <a href="lyear_components_progress.html">进度条</a> </li>
<li> <a href="lyear_components_scrollspy.html">滚动监听</a> </li>
<li> <a href="lyear_components_spinners.html">加载状态</a> </li>
<li> <a href="lyear_components_toasts.html">通知消息</a> </li>
<li> <a href="lyear_components_tooltips.html">工具提示</a> </li>
<li> <a href="lyear_components_other.html">其他</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-card-bulleted-outline"></i>
<span>助手</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_helpers_clearfix.html">清除浮动</a> </li>
<li> <a href="lyear_helpers_colored_links.html">彩色链接</a> </li>
<li> <a href="lyear_helpers_ratio.html">比例</a> </li>
<li> <a href="lyear_helpers_position.html">定位</a> </li>
<li> <a href="lyear_helpers_stacks.html">堆叠</a> </li>
<li> <a href="lyear_helpers_visually_hidden.html">视觉隐藏</a> </li>
<li> <a href="lyear_helpers_stretched_link.html">延伸链接</a> </li>
<li> <a href="lyear_helpers_text_truncation.html">文本截断</a> </li>
<li> <a href="lyear_helpers_vertical_rule.html">垂直法则</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-map-search-outline"></i>
<span>工具类</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_utilities_background.html">背景</a> </li>
<li> <a href="lyear_utilities_borders.html">边框</a> </li>
<li> <a href="lyear_utilities_colors.html">颜色</a> </li>
<li> <a href="lyear_utilities_display.html">显示属性</a> </li>
<li> <a href="lyear_utilities_flex.html">弹性布局</a> </li>
<li> <a href="lyear_utilities_float.html">浮动</a> </li>
<li> <a href="lyear_utilities_interactions.html">交互</a> </li>
<li> <a href="lyear_utilities_opacity.html">透明度</a> </li>
<li> <a href="lyear_utilities_overflow.html">溢出处理</a> </li>
<li> <a href="lyear_utilities_position.html">定位</a> </li>
<li> <a href="lyear_utilities_shadows.html">阴影</a> </li>
<li> <a href="lyear_utilities_sizing.html">尺寸</a> </li>
<li> <a href="lyear_utilities_spacing.html">间距</a> </li>
<li> <a href="lyear_utilities_text.html">文本</a> </li>
<li> <a href="lyear_utilities_vertical_align.html">垂直对齐</a> </li>
<li> <a href="lyear_utilities_visibility.html">可见性</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-stove"></i>
<span>示例页面</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_pages_doc.html">文档列表</a> </li>
<li> <a href="lyear_pages_table.html">表格插件</a> </li>
<li> <a href="lyear_pages_gallery.html">图库列表</a> </li>
<li> <a href="lyear_pages_config.html">网站配置</a> </li>
<li> <a href="lyear_pages_rabc.html">设置权限</a> </li>
<li> <a href="lyear_pages_add_doc.html">新增文档</a> </li>
<li> <a href="lyear_pages_login_1.html" target="_blank">登录页面1</a> </li>
<li> <a href="lyear_pages_login_2.html" target="_blank">登录页面2</a> </li>
<li> <a href="lyear_pages_login_3.html" target="_blank">登录页面3</a> </li>
<li> <a href="lyear_pages_login_4.html" target="_blank">登录页面4</a> </li>
<li> <a href="lyear_pages_error.html">错误页面</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-card-text-outline"></i>
<span>其他内容</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_other_icons.html">图标</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-file-code-outline"></i>
<span>JS 插件</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_pages_guide.html">表单向导</a> </li>
<li> <a href="lyear_js_datepicker.html">日期选取器</a> </li>
<li> <a href="lyear_js_colorpicker.html">选色器</a> </li>
<li> <a href="lyear_js_chartjs.html">Chart.js</a> </li>
<li> <a href="lyear_js_jconfirm.html">对话框</a> </li>
<li> <a href="lyear_js_tags_input.html">标签插件</a> </li>
<li> <a href="lyear_js_notify.html">通知消息</a> </li>
<li> <a href="lyear_js_maxlength.html">长度判断</a> </li>
<li> <a href="lyear_js_select.html">下拉选择</a> </li>
<li> <a href="lyear_js_fullcalendar.html">日程插件</a> </li>
<li> <a href="lyear_js_loading.html">loading插件</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-folder-text-outline"></i>
<span>多级菜单</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="#!">一级菜单</a> </li>
<li class="nav-item nav-item-has-subnav">
<a href="#!">一级菜单</a>
<ul class="nav nav-subnav">
<li> <a href="#!">二级菜单</a> </li>
<li class="nav-item nav-item-has-subnav">
<a href="#!">二级菜单</a>
<ul class="nav nav-subnav">
<li> <a href="#!">三级菜单</a> </li>
<li> <a href="#!">三级菜单</a> </li>
</ul>
</li>
</ul>
</li>
<li> <a href="#!">一级菜单</a> </li>
</ul>
</li>
</ul>
</nav>
<div class="sidebar-footer">
<p class="copyright">
<span>Copyright &copy; 2022. </span>
<a target="_blank" href="http://www.bixiaguangnian.com">笔下光年</a>
<span> All rights reserved.</span>
</p>
</div>
</div>
</aside>
<!--End 左侧导航-->
<!--头部信息-->
<header class="lyear-layout-header">
<nav class="navbar">
<div class="navbar-left">
<div class="lyear-aside-toggler">
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
</div>
</div>
<ul class="navbar-right d-flex align-items-center">
<!--顶部消息部分-->
<li class="dropdown dropdown-notice">
<span data-bs-toggle="dropdown" class="position-relative icon-item">
<i class="mdi mdi-bell-outline fs-5"></i>
<span class="position-absolute translate-middle badge bg-danger">7</span>
</span>
<div class="dropdown-menu dropdown-menu-end">
<div class="lyear-notifications">
<div class="lyear-notifications-title d-flex justify-content-between" data-stopPropagation="true">
<span>你有 10 条未读消息</span>
<a href="#!">查看全部</a>
</div>
<div class="lyear-notifications-info lyear-scroll">
<a href="#!" class="dropdown-item"
title="树莓派销量猛增,疫情期间居家工作学习、医疗领域都需要它">树莓派销量猛增,疫情期间居家工作学习、医疗领域都需要它</a>
<a href="#!" class="dropdown-item"
title="GNOME 用户体验团队将为 GNOME Shell 提供更多改进">GNOME 用户体验团队将为 GNOME Shell
提供更多改进</a>
<a href="#!" class="dropdown-item"
title="Linux On iPhone 即将面世,支持 iOS 的双启动">Linux On iPhone 即将面世,支持 iOS
的双启动</a>
<a href="#!" class="dropdown-item" title="GitHub 私有仓库完全免费面向团队提供">GitHub
私有仓库完全免费面向团队提供</a>
<a href="#!" class="dropdown-item"
title="Wasmtime 为 WebAssembly 增加 Go 语言绑定">Wasmtime 为 WebAssembly 增加 Go
语言绑定</a>
<a href="#!" class="dropdown-item"
title="红帽借“订阅”成开源一哥,首创者 Cormier 升任总裁">红帽借“订阅”成开源一哥,首创者 Cormier 升任总裁</a>
<a href="#!" class="dropdown-item" title="Zend 宣布推出两项 PHP 新产品">Zend 宣布推出两项
PHP 新产品</a>
</div>
</div>
</div>
</li>
<!--End 顶部消息部分-->
<!--切换主题配色-->
<li class="dropdown dropdown-skin">
<span data-bs-toggle="dropdown" class="icon-item">
<i class="mdi mdi-palette fs-5"></i>
</span>
<ul class="dropdown-menu dropdown-menu-end" data-stopPropagation="true">
<li class="lyear-skin-title"><p>主题</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_1" value="default" checked="checked">
<label class="form-check-label" for="site_theme_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_2" value="translucent-green">
<label class="form-check-label" for="site_theme_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_3" value="translucent-blue">
<label class="form-check-label" for="site_theme_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_4" value="translucent-yellow">
<label class="form-check-label" for="site_theme_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_5" value="translucent-red">
<label class="form-check-label" for="site_theme_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_6" value="translucent-pink">
<label class="form-check-label" for="site_theme_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_7" value="translucent-cyan">
<label class="form-check-label" for="site_theme_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_8" value="dark">
<label class="form-check-label" for="site_theme_8"></label>
</div>
</li>
<li class="lyear-skin-title"><p>LOGO</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_1" value="default" checked="checked">
<label class="form-check-label" for="logo_bg_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_2" value="color_2">
<label class="form-check-label" for="logo_bg_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_3" value="color_3">
<label class="form-check-label" for="logo_bg_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_4" value="color_4">
<label class="form-check-label" for="logo_bg_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_5" value="color_5">
<label class="form-check-label" for="logo_bg_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_6" value="color_6">
<label class="form-check-label" for="logo_bg_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_7" value="color_7">
<label class="form-check-label" for="logo_bg_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_8" value="color_8">
<label class="form-check-label" for="logo_bg_8"></label>
</div>
</li>
<li class="lyear-skin-title"><p>头部</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_1" value="default" checked="checked">
<label class="form-check-label" for="header_bg_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_2" value="color_2">
<label class="form-check-label" for="header_bg_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_3" value="color_3">
<label class="form-check-label" for="header_bg_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_4" value="color_4">
<label class="form-check-label" for="header_bg_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_5" value="color_5">
<label class="form-check-label" for="header_bg_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_6" value="color_6">
<label class="form-check-label" for="header_bg_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_7" value="color_7">
<label class="form-check-label" for="header_bg_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_8" value="color_8">
<label class="form-check-label" for="header_bg_8"></label>
</div>
</li>
<li class="lyear-skin-title"><p>侧边栏</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_1" value="default" checked="checked">
<label class="form-check-label" for="sidebar_bg_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_2" value="color_2">
<label class="form-check-label" for="sidebar_bg_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_3" value="color_3">
<label class="form-check-label" for="sidebar_bg_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_4" value="color_4">
<label class="form-check-label" for="sidebar_bg_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_5" value="color_5">
<label class="form-check-label" for="sidebar_bg_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_6" value="color_6">
<label class="form-check-label" for="sidebar_bg_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_7" value="color_7">
<label class="form-check-label" for="sidebar_bg_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_8" value="color_8">
<label class="form-check-label" for="sidebar_bg_8"></label>
</div>
</li>
</ul>
</li>
<!--End 切换主题配色-->
<!--个人头像内容-->
<li class="dropdown">
<a href="javascript:void(0)" data-bs-toggle="dropdown" class="dropdown-toggle">
<img class="avatar-md rounded-circle" src="images/users/avatar.jpg" alt="笔下光年" />
<span style="margin-left: 10px;">笔下光年</span>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li>
<a class="dropdown-item" href="lyear_pages_profile.html"
href="javascript:void(0)">
<i class="mdi mdi-account"></i>
<span>个人信息</span>
</a>
</li>
<li>
<a class="dropdown-item" href="lyear_pages_edit_pwd.html"
href="javascript:void(0)">
<i class="mdi mdi-lock-outline"></i>
<span>修改密码</span>
</a>
</li>
<li>
<a class="dropdown-item" href="javascript:void(0)">
<i class="mdi mdi-delete"></i>
<span>清空缓存</span>
</a>
</li>
<li class="dropdown-divider"></li>
<li>
<a class="dropdown-item" href="lyear_pages_login_1.html">
<i class="mdi mdi-logout-variant"></i>
<span>退出登录</span>
</a>
</li>
</ul>
</li>
<!--End 个人头像内容-->
</ul>
</nav>
</header>
<!--End 头部信息-->
<!--页面主要内容-->
<main class="lyear-layout-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<header class="card-header"><div class="card-title">验证</div></header>
<div class="card-body">
<p>通过 HTML5 表单验证,通过浏览器默认行为或自定义样式和 JavaScript,为您的用户提供有价值的、可操作的反馈。</p>
<div class="callout callout-warning mb-3">我们知道目前无法访问客户端自定义验证样式和工具提示,因为它们没有暴露于辅助技术。在我们研究解决方案时,我们建议使用服务器端选项或默认浏览器验证方法。</div>
<h6>怎么运行的</h6>
<p>下面是表单验证如何与 Bootstrap 一起工作:</p>
<ul>
<li>HTML 表单验证通过 CSS 的两个伪类 <code>:invalid</code><code>:valid</code> 应用。它适用于 <code>&lt;input&gt;</code><code>&lt;select&gt;</code><code>&lt;textarea&gt;</code> 元素。</li>
<li>Bootstrap 将 <code>:invalid</code><code>:valid</code> 样式限定为父 <code>.was-validated</code> 类,通常应用于 <code>&lt;form&gt;</code>。否则,任何没有值的必填字段在页面加载时显示为无效。这样,您可以选择何时激活它们(通常在尝试提交表单之后)。</li>
<li>要重置表单的外观(例如,在使用 AJAX 进行动态表单提交的情况下),请在提交后再次从 <code>&lt;form&gt;</code> 中删除 <code>.was-validated</code> 类。</li>
<li>作为后备,可以使用 <code>.is-invalid</code><code>.is-valid</code> 类代替伪类进行服务器端验证。它们不需要 <code>.was-validated</code> 父类。</li>
<li>由于 CSS 工作方式的限制,如果没有自定义 JavaScript 的帮助,我们(目前)无法将样式应用于 DOM 中表单控件之前的 <code>&lt;label&gt;</code></li>
<li>所有现代浏览器都支持约束验证 API,这是一系列用于验证表单控件的 JavaScript 方法。</li>
<li>反馈消息可以使用浏览器默认设置(每个浏览器不同,并且无法通过 CSS 设置样式)或我们的自定义反馈样式以及额外的 HTML 和 CSS。</li>
<li>您可以在 JavaScript 中使用 <code>setCustomValidity</code> 提供自定义有效性消息。</li>
</ul>
<p>考虑到这一点,请考虑以下演示,了解我们的自定义表单验证样式、可选的服务器端类和浏览器默认设置。</p>
<h6>自定义样式</h6>
<p>对于自定义 Bootstrap 表单验证消息,您需要将 novalidate 布尔属性添加到您的 <code>&lt;form&gt;</code>。这将禁用浏览器默认反馈工具提示,但仍提供对 JavaScript 中表单验证 API 的访问。尝试提交以下表格;我们的 JavaScript 将拦截提交按钮并将反馈转发给您。尝试提交时,您会看到应用于表单控件的 <code>:invalid</code><code>:valid</code> 样式。</p>
<p>自定义反馈样式应用自定义颜色、边框、焦点样式和背景图标以更好地传达反馈。 <code>&lt;select&gt;</code> 的背景图标仅适用于 <code>.form-select</code>,不适用于 <code>.form-control</code></p>
<div class="border-example">
<form class="row g-3 needs-validation" novalidate>
<div class="col-md-4">
<label for="validationCustom01" class="form-label">姓名</label>
<input type="text" class="form-control" id="validationCustom01" value="张辽" required>
<div class="valid-feedback">
正确
</div>
</div>
<div class="col-md-4">
<label for="validationCustom02" class="form-label"></label>
<input type="text" class="form-control" id="validationCustom02" value="文远" required>
<div class="valid-feedback">
正确
</div>
</div>
<div class="col-md-4">
<label for="validationCustomUsername" class="form-label">用户名</label>
<div class="input-group has-validation">
<span class="input-group-text" id="inputGroupPrepend">@</span>
<input type="text" class="form-control" id="validationCustomUsername" aria-describedby="inputGroupPrepend" required>
<div class="invalid-feedback">
请选择一个用户名。
</div>
</div>
</div>
<div class="col-md-6">
<label for="validationCustom03" class="form-label">城市</label>
<input type="text" class="form-control" id="validationCustom03" required>
<div class="invalid-feedback">
请提供一个正确的城市。
</div>
</div>
<div class="col-md-3">
<label for="validationCustom04" class="form-label">武器</label>
<select class="form-select" id="validationCustom04" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
<div class="invalid-feedback">
请选择你日常使用的武器。
</div>
</div>
<div class="col-md-3">
<label for="validationCustom05" class="form-label">邮编</label>
<input type="text" class="form-control" id="validationCustom05" required>
<div class="invalid-feedback">
请填写正确的邮编。
</div>
</div>
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
<label class="form-check-label" for="invalidCheck">
同意条款和条件
</label>
<div class="invalid-feedback">
你必须在提交前同意。
</div>
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" type="submit">提交表单</button>
</div>
</form>
</div>
<pre>&lt;form class="row g-3 needs-validation" novalidate&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationCustom01" class="form-label"&gt;姓名&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationCustom01" value="张辽" required&gt;
&lt;div class="valid-feedback"&gt;
正确
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationCustom02" class="form-label"&gt;&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationCustom02" value="文远" required&gt;
&lt;div class="valid-feedback"&gt;
正确
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationCustomUsername" class="form-label"&gt;用户名&lt;/label&gt;
&lt;div class="input-group has-validation"&gt;
&lt;span class="input-group-text" id="inputGroupPrepend"&gt;@&lt;/span&gt;
&lt;input type="text" class="form-control" id="validationCustomUsername" aria-describedby="inputGroupPrepend" required&gt;
&lt;div class="invalid-feedback"&gt;
请选择一个用户名。
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-6"&gt;
&lt;label for="validationCustom03" class="form-label"&gt;城市&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationCustom03" required&gt;
&lt;div class="invalid-feedback"&gt;
请提供一个正确的城市。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-3"&gt;
&lt;label for="validationCustom04" class="form-label"&gt;武器&lt;/label&gt;
&lt;select class="form-select" id="validationCustom04" required&gt;
&lt;option selected disabled value=""&gt;请选择...&lt;/option&gt;
&lt;option&gt;...&lt;/option&gt;
&lt;/select&gt;
&lt;div class="invalid-feedback"&gt;
请选择你日常使用的武器。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-3"&gt;
&lt;label for="validationCustom05" class="form-label"&gt;邮编&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationCustom05" required&gt;
&lt;div class="invalid-feedback"&gt;
请填写正确的邮编。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;div class="form-check"&gt;
&lt;input class="form-check-input" type="checkbox" value="" id="invalidCheck" required&gt;
&lt;label class="form-check-label" for="invalidCheck"&gt;
同意条款和条件
&lt;/label&gt;
&lt;div class="invalid-feedback"&gt;
你必须在提交前同意。
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;button class="btn btn-primary" type="submit"&gt;提交表单&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;</pre>
<p>使用到的JS</p>
<pre>// Example starter JavaScript for disabling form submissions if there are invalid fields
(function () {
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.querySelectorAll('.needs-validation')
// Loop over them and prevent submission
Array.prototype.slice.call(forms)
.forEach(function (form) {
form.addEventListener('submit', function (event) {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})()</pre>
<h6>浏览器默认值</h6>
<p>对自定义验证反馈消息或编写 JavaScript 来更改表单行为不感兴趣?一切都好,您可以使用浏览器默认设置。尝试提交下面的表格。根据您的浏览器和操作系统,您会看到略有不同的反馈风格。</p>
<p>虽然这些反馈样式无法使用 CSS 设置样式,但您仍然可以通过 JavaScript 自定义反馈文本。</p>
<div class="border-example">
<form class="row g-3">
<div class="col-md-4">
<label for="validationDefault01" class="form-label">姓名</label>
<input type="text" class="form-control" id="validationDefault01" value="张辽" required>
</div>
<div class="col-md-4">
<label for="validationDefault02" class="form-label"></label>
<input type="text" class="form-control" id="validationDefault02" value="文远" required>
</div>
<div class="col-md-4">
<label for="validationDefaultUsername" class="form-label">用户名</label>
<div class="input-group">
<span class="input-group-text" id="inputGroupPrepend2">@</span>
<input type="text" class="form-control" id="validationDefaultUsername" aria-describedby="inputGroupPrepend2" required>
</div>
</div>
<div class="col-md-6">
<label for="validationDefault03" class="form-label">城市</label>
<input type="text" class="form-control" id="validationDefault03" required>
</div>
<div class="col-md-3">
<label for="validationDefault04" class="form-label">武器</label>
<select class="form-select" id="validationDefault04" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
</div>
<div class="col-md-3">
<label for="validationDefault05" class="form-label">邮编</label>
<input type="text" class="form-control" id="validationDefault05" required>
</div>
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required>
<label class="form-check-label" for="invalidCheck2">
同意条款和条件
</label>
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" type="submit">提交表单</button>
</div>
</form>
</div>
<pre>&lt;form class="row g-3"&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationDefault01" class="form-label"&gt;姓名&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationDefault01" value="张辽" required&gt;
&lt;/div&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationDefault02" class="form-label"&gt;&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationDefault02" value="文远" required&gt;
&lt;/div&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationDefaultUsername" class="form-label"&gt;用户名&lt;/label&gt;
&lt;div class="input-group"&gt;
&lt;span class="input-group-text" id="inputGroupPrepend2"&gt;@&lt;/span&gt;
&lt;input type="text" class="form-control" id="validationDefaultUsername" aria-describedby="inputGroupPrepend2" required&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-6"&gt;
&lt;label for="validationDefault03" class="form-label"&gt;城市&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationDefault03" required&gt;
&lt;/div&gt;
&lt;div class="col-md-3"&gt;
&lt;label for="validationDefault04" class="form-label"&gt;武器&lt;/label&gt;
&lt;select class="form-select" id="validationDefault04" required&gt;
&lt;option selected disabled value=""&gt;请选择...&lt;/option&gt;
&lt;option&gt;...&lt;/option&gt;
&lt;/select&gt;
&lt;/div&gt;
&lt;div class="col-md-3"&gt;
&lt;label for="validationDefault05" class="form-label"&gt;邮编&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationDefault05" required&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;div class="form-check"&gt;
&lt;input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required&gt;
&lt;label class="form-check-label" for="invalidCheck2"&gt;
同意条款和条件
&lt;/label&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;button class="btn btn-primary" type="submit"&gt;提交表单&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;</pre>
<h6>服务器端</h6>
<p>我们建议使用客户端验证,但如果您需要服务器端验证,您可以使用 <code>.is-invalid</code><code>.is-valid</code> 指示无效和有效的表单字段。请注意,这些类也支持 <code>.invalid-feedback</code></p>
<p>对于无效字段,使用 <code>aria-describeby</code> 确保无效的反馈/错误消息与相关表单字段相关联(注意此属性允许引用多个 id,以防字段已指向其他表单文本)。</p>
<p>要解决边框半径问题,输入组需要额外的 <code>.has-validation</code> 类。</p>
<div class="border-example">
<form class="row g-3">
<div class="col-md-4">
<label for="validationServer01" class="form-label">姓名</label>
<input type="text" class="form-control is-valid" id="validationServer01" value="张辽" required>
<div class="valid-feedback">
正确
</div>
</div>
<div class="col-md-4">
<label for="validationServer02" class="form-label"></label>
<input type="text" class="form-control is-valid" id="validationServer02" value="文远" required>
<div class="valid-feedback">
正确
</div>
</div>
<div class="col-md-4">
<label for="validationServerUsername" class="form-label">用户名</label>
<div class="input-group has-validation">
<span class="input-group-text" id="inputGroupPrepend3">@</span>
<input type="text" class="form-control is-invalid" id="validationServerUsername" aria-describedby="inputGroupPrepend3 validationServerUsernameFeedback" required>
<div id="validationServerUsernameFeedback" class="invalid-feedback">
请选择一个用户名。
</div>
</div>
</div>
<div class="col-md-6">
<label for="validationServer03" class="form-label">城市</label>
<input type="text" class="form-control is-invalid" id="validationServer03" aria-describedby="validationServer03Feedback" required>
<div id="validationServer03Feedback" class="invalid-feedback">
请提供一个正确的城市。
</div>
</div>
<div class="col-md-3">
<label for="validationServer04" class="form-label">武器</label>
<select class="form-select is-invalid" id="validationServer04" aria-describedby="validationServer04Feedback" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
<div id="validationServer04Feedback" class="invalid-feedback">
请选择你日常使用的武器。
</div>
</div>
<div class="col-md-3">
<label for="validationServer05" class="form-label">邮编</label>
<input type="text" class="form-control is-invalid" id="validationServer05" aria-describedby="validationServer05Feedback" required>
<div id="validationServer05Feedback" class="invalid-feedback">
请填写正确的邮编。
</div>
</div>
<div class="col-12">
<div class="form-check">
<input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" aria-describedby="invalidCheck3Feedback" required>
<label class="form-check-label" for="invalidCheck3">
同意条款和条件
</label>
<div id="invalidCheck3Feedback" class="invalid-feedback">
你必须在提交前同意。
</div>
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" type="submit">提交表单</button>
</div>
</form>
</div>
<pre>&lt;form class="row g-3"&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationServer01" class="form-label"&gt;姓名&lt;/label&gt;
&lt;input type="text" class="form-control is-valid" id="validationServer01" value="张辽" required&gt;
&lt;div class="valid-feedback"&gt;
正确
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationServer02" class="form-label"&gt;&lt;/label&gt;
&lt;input type="text" class="form-control is-valid" id="validationServer02" value="文远" required&gt;
&lt;div class="valid-feedback"&gt;
正确
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-4"&gt;
&lt;label for="validationServerUsername" class="form-label"&gt;用户名&lt;/label&gt;
&lt;div class="input-group has-validation"&gt;
&lt;span class="input-group-text" id="inputGroupPrepend3"&gt;@&lt;/span&gt;
&lt;input type="text" class="form-control is-invalid" id="validationServerUsername" aria-describedby="inputGroupPrepend3 validationServerUsernameFeedback" required&gt;
&lt;div id="validationServerUsernameFeedback" class="invalid-feedback"&gt;
请选择一个用户名。
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-6"&gt;
&lt;label for="validationServer03" class="form-label"&gt;城市&lt;/label&gt;
&lt;input type="text" class="form-control is-invalid" id="validationServer03" aria-describedby="validationServer03Feedback" required&gt;
&lt;div id="validationServer03Feedback" class="invalid-feedback"&gt;
请提供一个正确的城市。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-3"&gt;
&lt;label for="validationServer04" class="form-label"&gt;武器&lt;/label&gt;
&lt;select class="form-select is-invalid" id="validationServer04" aria-describedby="validationServer04Feedback" required&gt;
&lt;option selected disabled value=""&gt;请选择...&lt;/option&gt;
&lt;option&gt;...&lt;/option&gt;
&lt;/select&gt;
&lt;div id="validationServer04Feedback" class="invalid-feedback"&gt;
请选择你日常使用的武器。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-3"&gt;
&lt;label for="validationServer05" class="form-label"&gt;邮编&lt;/label&gt;
&lt;input type="text" class="form-control is-invalid" id="validationServer05" aria-describedby="validationServer05Feedback" required&gt;
&lt;div id="validationServer05Feedback" class="invalid-feedback"&gt;
请填写正确的邮编。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;div class="form-check"&gt;
&lt;input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" aria-describedby="invalidCheck3Feedback" required&gt;
&lt;label class="form-check-label" for="invalidCheck3"&gt;
同意条款和条件
&lt;/label&gt;
&lt;div id="invalidCheck3Feedback" class="invalid-feedback"&gt;
你必须在提交前同意。
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;button class="btn btn-primary" type="submit"&gt;提交表单&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;</pre>
<h6>支持的元素</h6>
<p>验证样式可用于以下表单控件和组件:</p>
<ul>
<li><code>&lt;input&gt;</code>s 和 <code>&lt;textarea&gt;</code>s 带有 <code>.form-control</code>(在输入组中最多包括一个 <code>.form-control</code></li>
<li><code>&lt;select&gt;</code>s 与 <code>.form-select</code></li>
<li><code>.form-checks</code></li>
</ul>
<div class="border-example">
<form class="was-validated">
<div class="mb-3">
<label for="validationTextarea" class="form-label">文本域</label>
<textarea class="form-control is-invalid" id="validationTextarea" placeholder="必填示例文本区域" required></textarea>
<div class="invalid-feedback">
请在文本区输入消息。
</div>
</div>
<div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="validationFormCheck1" required>
<label class="form-check-label" for="validationFormCheck1">选中此复选框</label>
<div class="invalid-feedback">无效反馈文本示例</div>
</div>
<div class="form-check">
<input type="radio" class="form-check-input" id="validationFormCheck2" name="radio-stacked" required>
<label class="form-check-label" for="validationFormCheck2">切换此单选框</label>
</div>
<div class="form-check mb-3">
<input type="radio" class="form-check-input" id="validationFormCheck3" name="radio-stacked" required>
<label class="form-check-label" for="validationFormCheck3">或切换其他单选框</label>
<div class="invalid-feedback">更多示例无效反馈文本</div>
</div>
<div class="mb-3">
<select class="form-select" required aria-label="下拉选择示例">
<option value="">打开此选择菜单</option>
<option value="1">三宝太监西洋记</option>
<option value="2">三略</option>
<option value="3">上古神话演义</option>
</select>
<div class="invalid-feedback">示例无效的选择反馈</div>
</div>
<div class="mb-3">
<input type="file" class="form-control" aria-label="上传示例" required>
<div class="invalid-feedback">无效的表单文件反馈示例</div>
</div>
<div class="mb-3">
<button class="btn btn-primary" type="submit" disabled>提交表单</button>
</div>
</form>
</div>
<pre>&lt;form class="was-validated"&gt;
&lt;div class="mb-3"&gt;
&lt;label for="validationTextarea" class="form-label"&gt;文本域&lt;/label&gt;
&lt;textarea class="form-control is-invalid" id="validationTextarea" placeholder="必填示例文本区域" required&gt;&lt;/textarea&gt;
&lt;div class="invalid-feedback"&gt;
请在文本区输入消息。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="form-check mb-3"&gt;
&lt;input type="checkbox" class="form-check-input" id="validationFormCheck1" required&gt;
&lt;label class="form-check-label" for="validationFormCheck1"&gt;选中此复选框&lt;/label&gt;
&lt;div class="invalid-feedback"&gt;无效反馈文本示例&lt;/div&gt;
&lt;/div&gt;
&lt;div class="form-check"&gt;
&lt;input type="radio" class="form-check-input" id="validationFormCheck2" name="radio-stacked" required&gt;
&lt;label class="form-check-label" for="validationFormCheck2"&gt;切换此单选框&lt;/label&gt;
&lt;/div&gt;
&lt;div class="form-check mb-3"&gt;
&lt;input type="radio" class="form-check-input" id="validationFormCheck3" name="radio-stacked" required&gt;
&lt;label class="form-check-label" for="validationFormCheck3"&gt;或切换其他单选框&lt;/label&gt;
&lt;div class="invalid-feedback"&gt;更多示例无效反馈文本&lt;/div&gt;
&lt;/div&gt;
&lt;div class="mb-3"&gt;
&lt;select class="form-select" required aria-label="下拉选择示例"&gt;
&lt;option value=""&gt;打开此选择菜单&lt;/option&gt;
&lt;option value="1"&gt;三宝太监西洋记&lt;/option&gt;
&lt;option value="2"&gt;三略&lt;/option&gt;
&lt;option value="3"&gt;上古神话演义&lt;/option&gt;
&lt;/select&gt;
&lt;div class="invalid-feedback"&gt;示例无效的选择反馈&lt;/div&gt;
&lt;/div&gt;
&lt;div class="mb-3"&gt;
&lt;input type="file" class="form-control" aria-label="上传示例" required&gt;
&lt;div class="invalid-feedback"&gt;无效的表单文件反馈示例&lt;/div&gt;
&lt;/div&gt;
&lt;div class="mb-3"&gt;
&lt;button class="btn btn-primary" type="submit" disabled&gt;提交表单&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;</pre>
<h6>工具提示</h6>
<p>如果您的表单布局允许,您可以将 <code>.{valid|invalid}-feedback</code> 类交换为 <code>.{valid|invalid}-tooltip</code> 类,以在样式化的工具提示中显示验证反馈。确保有一个带有 <code>position: relative</code> 的父级用于工具提示定位。在下面的示例中,我们的列类已经具有此功能,但您的项目可能需要其他设置。</p>
<div class="border-example">
<form class="row g-3 needs-validation" novalidate>
<div class="col-md-4 position-relative">
<label for="validationTooltip01" class="form-label">姓名</label>
<input type="text" class="form-control" id="validationTooltip01" value="张辽" required>
<div class="valid-tooltip">
正确
</div>
</div>
<div class="col-md-4 position-relative">
<label for="validationTooltip02" class="form-label"></label>
<input type="text" class="form-control" id="validationTooltip02" value="文远" required>
<div class="valid-tooltip">
正确
</div>
</div>
<div class="col-md-4 position-relative">
<label for="validationTooltipUsername" class="form-label">用户名</label>
<div class="input-group has-validation">
<span class="input-group-text" id="validationTooltipUsernamePrepend">@</span>
<input type="text" class="form-control" id="validationTooltipUsername" aria-describedby="validationTooltipUsernamePrepend" required>
<div class="invalid-tooltip">
请选择一个用户名。
</div>
</div>
</div>
<div class="col-md-6 position-relative">
<label for="validationTooltip03" class="form-label">城市</label>
<input type="text" class="form-control" id="validationTooltip03" required>
<div class="invalid-tooltip">
请提供一个正确的城市。
</div>
</div>
<div class="col-md-3 position-relative">
<label for="validationTooltip04" class="form-label">武器</label>
<select class="form-select" id="validationTooltip04" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
<div class="invalid-tooltip">
请选择你日常使用的武器。
</div>
</div>
<div class="col-md-3 position-relative">
<label for="validationTooltip05" class="form-label">邮编</label>
<input type="text" class="form-control" id="validationTooltip05" required>
<div class="invalid-tooltip">
请填写正确的邮编。
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" type="submit">提交表单</button>
</div>
</form>
</div>
<pre>&lt;form class="row g-3 needs-validation" novalidate&gt;
&lt;div class="col-md-4 position-relative"&gt;
&lt;label for="validationTooltip01" class="form-label"&gt;姓名&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationTooltip01" value="张辽" required&gt;
&lt;div class="valid-tooltip"&gt;
正确
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-4 position-relative"&gt;
&lt;label for="validationTooltip02" class="form-label"&gt;&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationTooltip02" value="文远" required&gt;
&lt;div class="valid-tooltip"&gt;
正确
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-4 position-relative"&gt;
&lt;label for="validationTooltipUsername" class="form-label"&gt;用户名&lt;/label&gt;
&lt;div class="input-group has-validation"&gt;
&lt;span class="input-group-text" id="validationTooltipUsernamePrepend"&gt;@&lt;/span&gt;
&lt;input type="text" class="form-control" id="validationTooltipUsername" aria-describedby="validationTooltipUsernamePrepend" required&gt;
&lt;div class="invalid-tooltip"&gt;
请选择一个用户名。
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-6 position-relative"&gt;
&lt;label for="validationTooltip03" class="form-label"&gt;城市&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationTooltip03" required&gt;
&lt;div class="invalid-tooltip"&gt;
请提供一个正确的城市。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-3 position-relative"&gt;
&lt;label for="validationTooltip04" class="form-label"&gt;武器&lt;/label&gt;
&lt;select class="form-select" id="validationTooltip04" required&gt;
&lt;option selected disabled value=""&gt;请选择...&lt;/option&gt;
&lt;option&gt;...&lt;/option&gt;
&lt;/select&gt;
&lt;div class="invalid-tooltip"&gt;
请选择你日常使用的武器。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-3 position-relative"&gt;
&lt;label for="validationTooltip05" class="form-label"&gt;邮编&lt;/label&gt;
&lt;input type="text" class="form-control" id="validationTooltip05" required&gt;
&lt;div class="invalid-tooltip"&gt;
请填写正确的邮编。
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-12"&gt;
&lt;button class="btn btn-primary" type="submit"&gt;提交表单&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;</pre>
</div>
</div>
</div>
</div>
</div>
</main>
<!--End 页面主要内容-->
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript">
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function () {
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.querySelectorAll('.needs-validation')
// Loop over them and prevent submission
Array.prototype.slice.call(forms)
.forEach(function (form) {
form.addEventListener('submit', function (event) {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})()
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/yinqi/Light-Year-Admin-Template-v5.git
git@gitee.com:yinqi/Light-Year-Admin-Template-v5.git
yinqi
Light-Year-Admin-Template-v5
Light Year Admin v5
master

搜索帮助