Find your content:

Search form

You are here

Web2Case & HTML 4 Id & Name compliance


I need to provide a webteam with HTML for a web2case form, the issue is that they are sticklers for compliance and insist that I provide them with HTML4 compliant code.

Unfortunately the auto-generated code does not meet this standard :

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").”


First Name: <input  id="00NP0000000eRsA" maxlength="50" name="00NP0000000eRsA" size="20" type="text" /><br>

Has anyone come across this issue previously and resolved it? perhaps by javascript?

Attribution to: Mitch Hunt

Possible Suggestion/Solution #1

You could change the IDs using JavaScript. Will the web team allow this minor exception because it is provided by a 3rd party? That is pretty much our stance for pages we control 100% we keep it compliant but will make exceptions when it makes sense.

The other thing you can do is search the Ideas board to see if there any for making Web2Lead and Web2Case HTML compliant. If none exist you could start one and promote it.

Attribution to: Mike Chale

Possible Suggestion/Solution #2

The form inputs where the id and name attributes start with "00N" are custom field definitions. So basically any non-standard fields you select to go in the form will start with 00N.

Salesforce will be expecting the postback form keys to be these values, so you would need to use Javascript to restore any values you change before submitting the form if you change them.

I.e. you could manually prefix the ids and names with something to make them compliant.

<form action="" 
  method="POST" onsubmit="return removeCustomFieldPrefix();">
    First Name: <input  id="customfield_00NP0000000eRsA" 
                        size="20" maxlength="50" type="text" /><br>
    <input type="submit" name="submit">

Then wire up some Javascript to the form submission that will strip off the "customfield_" prefix before posting back the form data.

function removeCustomFieldPrefix()
    // TODO: Remove the customfield_ prefix from the form inputs before submitting.
    return true;

Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content