表单模式正在按预期工作

时间:2017-10-18 23:20:25

标签: html5 forms

任何人都可以告诉我我的模式有什么问题,或者我做错了什么。

First have look at the code 



 <style>
        input:invalid ~ span:before {
                   content: "not good";
               }
               input:valid ~ span:before {
                   content: "good";
               }
               input {
                   display: block;
               }
        </style>
        <form action="">
                <input type="text" 
 pattern="(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$
        "><span>    </span>
                </form>
&#13;
&#13;
&#13;

对于模式,我想要的输入字段必须包含一个小写字母,一个大写字母和一个数字或一个特殊字符,我不确定模式是否正确,

所以在我的头像这样的 @ 9aLkfjakdj 应该显示我good,这意味着我的输入是正确的。

但是一旦我运行我的代码,它就会试图杀死我,它会告诉我good,这意味着他们在输入字段中什么都没有,为什么它说这一切都很好,而且无论如何我输入了输入字段,它总是显示not good

  我基本上在风格上说,如果输入字段是正确的,请告诉我   文本很好,当它没有显示我的文字不好时,

谢谢

1 个答案:

答案 0 :(得分:0)

17:37:19 **** Incremental Build of configuration Debug for project Store Management Game **** Info: Internal Builder is used for build g++ -std=c++11 -O0 -g3 -Wall -c -fmessage-length=0 -o Game.o "..\\Game.cpp" In file included from C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/thread:39:0, from ..\Game.hpp:16, from ..\Game.cpp:9: C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional: In instantiation of 'struct std::_Bind_check_arity<void (Game::*)()>': C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional:1538:12: required from 'struct std::_Bind_simple_helper<void (Game::*)()>' C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional:1552:5: required by substitution of 'template<class _Callable, class ... _Args> typename std::_Bind_simple_helper<_Func, _BoundArgs>::__type std::__bind_simple(_Callable&&, _Args&& ...) [with _Callable = void (Game::*)(); _Args = {}]' C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/thread:142:59: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (Game::*)(); _Args = {}]' ..\Game.cpp:33:46: required from here C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional:1426:7: error: static assertion failed: Wrong number of arguments for pointer-to-member static_assert(_Varargs::value ^ C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional: In instantiation of 'struct std::_Bind_simple<std::_Mem_fn<void (Game::*)()>()>': C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/thread:142:59: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (Game::*)(); _Args = {}]' ..\Game.cpp:33:46: required from here C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional:1505:61: error: no type named 'type' in 'class std::result_of<std::_Mem_fn<void (Game::*)()>()>' typedef typename result_of<_Callable(_Args...)>::type result_type; ^ C:/Program Files/Haskell Platform/8.0.1/mingw/include/c++/5.2.0/functional:1526:9: error: no type named 'type' in 'class std::result_of<std::_Mem_fn<void (Game::*)()>()>' _M_invoke(_Index_tuple<_Indices...>) ^ 17:37:20 Build Finished (took 583ms) email等输入类型是可选的,因此值为“好”而不是“不好”的原因。

此处有更多信息:https://css-tricks.com/almanac/selectors/v/valid/

text