-
- 572 Posts
Hi,
I’m sure i’ve done something wrong here...i’m not sure where to add any validation to eform. I understand that the [+validationmessage+] will display the validaion message but i can’t see where to make the inputs manadatory.
as an example..
<label accesskey="e" for="email">Your Email Address<span class="required">(required)</span></label><br />
<input class="textfield" id="email" maxlength="40" name="email" size="40" type="text" />
..do i add &requiredClass somewhere on the form to make a mandatory field?
Thanks for any help
www.9thwave.co.uk
WEB | DESIGN | PRINT
You need to add the custom eform attribute to the field (don’t worry about validation, the attribute is removed when eForm processes the form template)
<label accesskey="e" for="email">Your Email Address<span class="required">(required)</span></label><br />
<input class="textfield" id="email" maxlength="40" name="email" size="40" type="text" eform="Email:email:1" />
The eForm documentation goes into a lot more detail about using the field attribute, but basically it’s eform="Field Label:expected data type:required (0 or 1)". The Field Label will be what is used in the invalid error message; the expected data type can be left blank if it’s plain text or a few other type (again, the documentation goes into more detail); the required part is 1 for required, 0 for not required. Even if the field is not required, you still need the eform attribute if you want this field to be available as a placeholder (in the report template, for example).