[TYPO3-english] Mailformplus - validate

Kristian Wind kw at hovsa.dk
Mon Apr 19 01:14:15 CEST 2010


Hello!

I'm having a bit of trouble validating a Mailformplus mail form. The reason is that the fields are already filled out with the default value...

I am using a "clear script" to clear the fields when selected. This means that if I do not select any field, Mailformplus thinks these are already filled in. All the fields are required (defined in TYPO3).

The mail form is in 5 different languages - each with its own template.


My question: is there any way to validate using something like "if the field is empty or still Name, then..."? Or perhaps something else?


"Clear Script" code (from JavaScriptKit.com):
<script>
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 
</script>


Form code:
<form name="Formular" method="post" action="###REL_URL###" enctype="multipart/form-data">
<fieldset style="border:none; margin: -5px;">
    <input type="hidden" name="id" value="###PID###" />
    <input type="hidden" name="submitted" value="1" />
    <input type="hidden" name="L" value="###value_L###" />
    <input type="hidden" name="type" value="###value_type###" />
    
    <div id="mailformwrapper">
        <div id="mailformtxt">If you would like to hear more about the advantages, fill in the form below and we will call you.</div>
        <div id="mailformnavn">###error_yourname###<input type="text" name="yourname" id="yourname" value="Your name" onFocus="clearText(this)" tabindex="1" /></div>
        <div id="mailformfirma">###error_company###<input type="text" name="company" id="company" value="Company" onFocus="clearText(this)" tabindex="2" /></div>
        <div id="mailformtlf">###error_phone###<input type="text" name="phone" id="phone" value="Phone number" onFocus="clearText(this)" tabindex="3" /></div>
        <div id="mailformsend"><a href="#" onclick="document.forms[0].submit()">Submit</a></div>
    </div>
</fieldset>
</form>


Thanks in advance!


Best regards,
Kristian Windkw at hovsa.dk

Tel: +45 89 93 77 30
Mob: +45 40 33 06 85

Lille Elstedvej 13B
DK-8520 Lystrup
Danmark



More information about the TYPO3-english mailing list