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?


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="https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" 
  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;
  • 1
    Yeah I had thought about something along those lines however unfortunately Javascript is not my forte so I guess this is something to push back to the web team. It sounds like this is something that is achievable with this approach though, thanks.
    – Mitch Hunt
    Oct 17 '12 at 1:11

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.

  • Thanks I have been checking around the boards this morning and could not find anything. I would have thought that this would have been an issue for a lot more people. I don't know if this would be a priority as HTML 5 will make this compliant I believe.
    – Mitch Hunt
    Oct 17 '12 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.