You need to sign in to do that
Don't have an account?
Web-to-case with HTML4
Hi all,
I am finishing up a web-to-case form but have run in to what appears like a glaring oversight from Salesforce.
I have written some Javascript to validate the end-user's responses before the form is sent. Some fields have max values, some are mandatory etc. The Javascript will look through the DOM for a field's ID and then run its logic tests. However, form fields in HTML4 cannot begin with a number. For the web-to-case to work properly, I have to specify the HTML field's ID to match the Salesforce ID for that field - which of course, start with a number.
So I can either:
- Run the web-to-case with no front end Javascript validation. However, validation will be respected on the Salesforce end, so if the user doesn't fill in a mandatory field and hits send; they will receive no notification that anything went wrong, neither will I, and everything they've written is lost as the transaction failed: no case created.
- Add a leading character to the field IDs. This will mean the Javascript will work, but obviously the transaction to Salesforce will fail as the IDs now do not match: no case created.
- Update the site to HTML5.
Obviously 3 is the only real choice, but this is slightly a pain and I did not anticipate having to do this for this piece of work. Salesforce should be transparent when you are setting up the web-to-case HTML that Javascript validation is not going to be possible on HTML4. It seems somewhat poorly thought out.
Found a solution.
Use:
document.getElementById('id')
instead of:
form.id
Bit messy, but it works
All Answers
Found a solution.
Use:
document.getElementById('id')
instead of:
form.id
Bit messy, but it works
That's in the help and training, by the way. Another solution is to use:
Which is "less messy".
Oh cool, thanks :)