You'd put this CSS stylesheet* in your <head>:
<style>
.mktoForm {
position: absolute;
visibility: hidden;
}
.mktoForm[data-dynamic-displayable="true"] {
position: static;
visibility: visible;
}
</style>
Then this JS right before the closing </body> tag:
<script>
(function(){
var mktoFields = {
FirstName : "{{Lead.First Name}}"
}
if( mktoFields.FirstName == "Amelia" ){
MktoForms2.whenReady(function(form){
var formEl = form.getFormElem()[0];
formEl.setAttribute("data-dynamic-displayable",true);
});
}
})();
</script>
Substituting your actual conditions for == "Amelia".
I need to note that your notion of "punctuation marks" isn't specific enough. There are lots of marks (Unicode Punctuation, * character categories) that are found in First Names. In Latin-1 alone, periods, parentheses, hyphens, apostrophes, and quotation marks are part of given names as entered on forms. Sure, there are hundreds of other punctuation marks that are not typically part of given names, but you have to ask yourself whether it's worth the penalty of telling people Your name is not your name in order to catch a few outliers. We err on the side of trust; I'm not going to tell someone who enters "Jane #2" that they can't buy a product, while some spam lead who happens to use the first name "Joe" is good.
.
Also note that South Indian given names (assigned initials) frequently are only one letter. It would be wrong to tell someone their effective first name is not "S", because that is their name, and it's not supposed to be spelled out. You'd just be alienating millions of potential leads.
* If anybody is curious about why I didn't use display:none; it's because the forms library must calculate the rendered width accurately.
Do this whenever you want to show a form conditionally (as opposed to load a form conditionally).
Here the named mktoForm element is always loading; otherwise you'd have to switch to the embed, which is wrong on Marketo LPs.