Skip to main content
HTML Validation

Bad value X for attribute “action” on element “form”: Illegal character in path segment. Space is not allowed.

About This HTML Issue

The path in a <form> element's action can't contain a literal space, so write each space as %20 or rename the target so its URL has none.

The action attribute holds the URL that receives the submitted form data, and the URL Standard doesn't allow spaces in a path. The validator reports it for values like /contact us/send.php or ./privacy policy.aspx. Accented letters such as í or ñ are allowed in a path, so only the space needs fixing.

Some server frameworks write the current page's file name into action when a form posts back to the same page. If that file name has a space in it, every page built from it reports this error, and renaming the file or route fixes all of them at once.

Browsers percent-encode the space before they submit, so the form usually still works. A crawler or a script that reads the raw value may not do the same, and the markup is invalid either way. Spaces at the very start or end of the value are allowed, because the URL parser strips them. A space after the ? gives a different message, Illegal character in query, and %20 fixes that one too.

Invalid example

<form method="post" action="/contact us/send.php">
  <label>
    Email
    <input type="email" name="email">
  </label>
  <button type="submit">Send</button>
</form>

Valid example: space encoded as %20

<form method="post" action="/contact%20us/send.php">
  <label>
    Email
    <input type="email" name="email">
  </label>
  <button type="submit">Send</button>
</form>

Valid example: hyphen instead of a space

<form method="post" action="/contact-us/send.php">
  <label>
    Email
    <input type="email" name="email">
  </label>
  <button type="submit">Send</button>
</form>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries