You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

未输入用户名密码点击登录时浏览器「Invalid Info」提示的移除方法咨询

Fixing the "Invalid Info" Prompt on Login Without JS/PHP Validation

Hey there! Let's tackle that pesky "Invalid Info" prompt popping up when you click login without entering a username or password. Since you haven't written any JS or PHP validation code, this is almost certainly coming from browser-native HTML5 form validation—here's how to turn it off:

1. Disable native validation for the entire form

The easiest way is to add the novalidate attribute directly to your <form> tag. This tells the browser to skip all built-in validation checks for that form entirely.

Example code:

<form action="your-login-handler.php" method="post" novalidate>
  <input type="text" name="username" placeholder="Enter username">
  <input type="password" name="password" placeholder="Enter password">
  <button type="submit">Login</button>
</form>

2. Remove required attributes from individual fields

If the prompt is only triggered by specific fields (like ones marked with required), you can just delete the required attribute from those input elements.

For example, change this:

<input type="text" name="username" required>

To this:

<input type="text" name="username">

Either of these methods should stop the browser from showing that "Invalid Info" message when you submit the empty form. If you ever want to add custom validation later, you can do so with JavaScript, but for now, these quick fixes should do the trick!

内容的提问来源于stack exchange,提问作者Nadee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:47:43