Question
How to Fix "An invalid form control with name='' is not focusable" in HTML Forms and ASP.NET Web Forms
Question
In Google Chrome, some users are unable to continue to the payment page when submitting a form. The browser console shows this error:
An invalid form control with name='' is not focusable.
A common explanation is that this happens when a hidden field still has validation requirements such as required. However, in this case the form uses ASP.NET Web Forms RequiredFieldValidator controls rather than the HTML5 required attribute.
The issue also appears inconsistent, affecting only some users.
What causes this error, and how can it be fixed in a form built with ASP.NET Web Forms?
Short Answer
By the end of this page, you will understand what Chrome means by "An invalid form control is not focusable", why it usually happens with hidden or non-focusable form fields, and how this interacts with ASP.NET Web Forms validation. You will also learn practical fixes, debugging steps, and how to prevent the issue in real projects.
Concept
This error comes from the browser's native form validation.
When a form is submitted, the browser checks whether all form controls are valid. If it finds an invalid control, it usually tries to:
- stop submission
- focus the invalid field
- show a validation message
That works only if the field can actually receive focus.
If the invalid field is hidden, disabled incorrectly, removed from layout, or otherwise not focusable, Chrome may report:
An invalid form control with name='' is not focusable.
Why this happens
This usually means:
- a field is invalid according to HTML form rules
- the browser tries to focus it
- the field cannot be focused
Common causes include:
- an input with
requiredthat is hidden withdisplay: none - a control inside a collapsed section or inactive tab
- a field generated dynamically but not shown yet
- duplicate validation systems fighting each other
- a field with no usable
nameor an emptyname
Why ASP.NET Web Forms can still be involved
Even if you are using RequiredFieldValidator, the browser may still perform HTML5 validation on the rendered HTML.
In Web Forms, what you write on the server is not always what the browser receives. A server control may render into HTML inputs that include validation-related attributes, or custom scripts may set attributes like later.
Mental Model
Think of form submission like a teacher checking homework.
- The browser is the teacher.
- Each form field is a student notebook.
- If one notebook is incomplete, the teacher points to it.
- But if that notebook is locked in a drawer, the teacher cannot point to it.
That is what this error means: the browser found a problem, but the field causing the problem is hidden or unreachable.
In other words:
- invalid = the field failed validation
- not focusable = the browser cannot move the cursor to it
So the real fix is usually not the error message itself. The fix is to make sure invalid fields are either:
- visible and focusable, or
- not validated until they are visible, or
- excluded from validation entirely when hidden
Syntax and Examples
The core idea is simple: do not leave required or invalid fields in a hidden, non-focusable state.
Example that causes the error
<form>
<input type="text" name="fullName" required>
<input type="text" name="couponCode" required style="display:none;">
<button type="submit">Submit</button>
</form>
If couponCode is hidden and empty, the browser may block submission and complain because it cannot focus that field.
Safer approach
Remove validation when the field is hidden, or disable the field.
<form>
<input type="text" name="fullName" required>
Submit
Step by Step Execution
Consider this small example:
<form id="signupForm">
<input id="email" name="email" type="email" required>
<input id="promo" name="promo" type="text" required style="display:none;">
<button type="submit">Submit</button>
</form>
Here is what happens when the user clicks Submit:
- The browser starts form validation.
- It checks
email.- If
emailis empty, the browser can focus it because it is visible.
- If
- It checks
promo.promois marked .
Real World Use Cases
This issue appears in many real applications:
Checkout and payment forms
A billing form may show extra fields only for certain payment methods. If hidden card fields remain required, submission fails.
Registration forms
A form may show company details only when the user selects Business account. Hidden company fields must not still be validated.
Multi-step forms
Step 2 fields may exist in the DOM while Step 1 is being submitted. If Step 2 fields are required but hidden, Chrome may block the form.
Tabs and accordions
Fields inside inactive tabs can still be part of the form. If they are invalid and hidden, the browser cannot focus them.
Dynamic forms from JavaScript frameworks or plugins
A plugin may hide elements visually but leave them active for validation.
ASP.NET Web Forms pages
Web Forms often combines server controls, validators, UpdatePanels, and conditional visibility. A control may be hidden on the server or client, but its validation state may not match.
Real Codebase Usage
In real projects, developers usually solve this by making visibility, enabled state, and validation rules move together.
Common patterns
Guard hidden fields from validation
If a section is hidden, disable its validators and often disable the controls too.
txtVatNumber.Enabled = isBusinessCustomer;
rfvVatNumber.Enabled = isBusinessCustomer;
Early return in JavaScript setup
If a section does not apply, stop adding validation attributes.
if (!isBusinessCustomer) {
vatInput.required = false;
vatInput.disabled = true;
return;
}
Validate only active step
In multi-step forms, validate the current step rather than the whole form at once.
Keep UI state and validation state in sync
Whenever a field is hidden:
- remove
required - clear custom validation messages
- disable the field if appropriate
- disable server-side validator controls if used
Use ValidationGroup in Web Forms
ASP.NET Web Forms supports ValidationGroup to limit which validators run for a specific button or workflow.
Common Mistakes
1. Hiding a required field with CSS only
Broken example:
<input name="phone" required style="display:none;">
Why it fails:
- The field is still part of validation.
- The browser cannot focus it.
Fix:
<input name="phone" disabled style="display:none;">
Or remove required when hidden.
2. Assuming ASP.NET validators are the only validation happening
Beginners often think RequiredFieldValidator completely replaces browser validation. It does not. The browser still validates actual HTML controls.
How to avoid it:
- inspect the rendered HTML
- check for
required, invalidtypevalues, pattern rules, and hidden visible-state issues
3. Disabling the validator but not the input logic
Broken approach:
Comparisons
| Approach | What it does | Good for | Risk or limitation |
|---|---|---|---|
| HTML5 native validation | Browser validates inputs automatically | Simple forms | Can fail on hidden invalid fields |
ASP.NET RequiredFieldValidator | Web Forms validation control | Server-centric Web Forms apps | Must stay in sync with UI visibility |
| Custom JavaScript validation | Full control over behavior | Complex dynamic forms | More code to maintain |
novalidate on form | Disables browser validation | Apps using only custom/server validation | Loses built-in browser help |
Visible=false in Web Forms | Control is not rendered | Safely remove hidden fields entirely |
Cheat Sheet
Quick rules
- Chrome throws this error when a field is invalid but cannot receive focus.
- Most often, the field is hidden with CSS or inside a hidden container.
RequiredFieldValidatordoes not automatically prevent native browser validation issues.- Always inspect the rendered HTML, not just server-side markup.
Safe fixes
- If a field is hidden, also:
- remove
required - disable the field
- disable related validators
- remove
- Use
ValidationGroupin ASP.NET Web Forms for separate sections. - Consider
novalidateonly if you intentionally rely on custom/server validation.
Common checks
const invalid = document.querySelector(':invalid');
console.log(invalid);
document.querySelectorAll('[required]').forEach(el => console.log(el));
FAQ
What does "An invalid form control is not focusable" mean?
It means the browser found an invalid field during form submission, but that field is hidden or otherwise cannot receive focus.
Why does the error show name=''?
Usually because the invalid form control has an empty name attribute or no useful name value in the rendered HTML.
Can this happen without using the HTML5 required attribute?
Yes. Native browser validation can still happen for other reasons, and rendered HTML or JavaScript may still apply validation constraints.
Does ASP.NET RequiredFieldValidator cause this directly?
Not directly. The underlying problem is usually in the rendered HTML and browser validation behavior, especially when fields are hidden but still active.
Is Visible=false safe in ASP.NET Web Forms?
Yes. If a control is not rendered, the browser cannot validate or focus it.
Should I use novalidate to fix it?
Only if you intentionally want to disable browser validation and you already have reliable client-side or server-side validation.
Why do only some users see the issue?
Because different users may trigger different UI states, autofill behavior, timing, browser versions, or hidden sections.
How do I find the field causing the problem?
Inspect the rendered page in DevTools and look for invalid controls, required fields, hidden containers, and inputs that are not focusable.
Mini Project
Description
Build a small checkout form with an optional company billing section. This demonstrates the real cause of the error and shows how to avoid it by keeping field visibility, enabled state, and validation rules synchronized.
Goal
Create a form that safely shows and hides optional fields without triggering browser validation errors.
Requirements
- Add a required customer name field that is always visible.
- Add a company checkbox that reveals a VAT number field only when checked.
- Make the VAT number required only when the company section is active.
- Ensure the hidden VAT field is not validated when the section is hidden.
- Prevent submission errors caused by hidden invalid controls.
Keep learning
Related questions
Allow Only Numeric Input (0-9) in HTML Input Using jQuery
Learn how to allow only digits 0-9 in an HTML input using jQuery, with examples, validation tips, common mistakes, and best practices.
CSS :not() Selector for Excluding a Class or Attribute
Learn how to use the CSS :not() selector to target elements that do not have a specific class or attribute, with examples and common mistakes.
Can HTML Checkboxes Be Readonly? Understanding readonly vs disabled in HTML Forms
Learn why HTML checkboxes do not support readonly, how disabled differs, and practical ways to prevent changes while still submitting values.