Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.9. Features

Validation of field values

JavaScript validation

Example

If you have activated validation JS in constants (default), than you can validate values of textfields just after input in frontend:

Example: Mandatory check

Example: E-Mail check

Check for:

This validation of textfields are currently possible:

  1. Mandatory

  2. E-Mail

  3. URL

  4. Numbers

  5. Numbers (with comma or point)

  6. Letters

  7. Letters and numbers

Error Message:

Note: Current error messages are in german and english – you can change or add your own messages via locallang or typoscript (see above)

Stylesheet classes to manipulate validation messages and input fields:

  1. If error in inputfields: <input class=“validation-failed” />

  2. If no error in inputfields: <input class=“validation-passed” />

  3. DIV Layer of errormessage: <div class=”powermail_mandatory_js”>error</div>

PHP validation

Email of sender

Email of user will be automaticly checked, as soon as the email field is selected in backend

Autocheck via typoscript

Use typoscript to check any field like (example to check uid41 if it is an email):

plugin.tx_powermail_pi1 {
validate.uid41.auto = email
validate.uid41.errormsg = Please check your email, there is an error!
}

This autochecks are possible:

  1. email: check if value is an email

  2. url: check if value is a correct url

  3. numbers: only numbers allowed

  4. phone: numbers and / and + and - allowed

  5. alphanum: only numbers and characters allowed

Manual check via typoscript (using regulare expressions)

Use typoscript (in the setup) to check any field like (example to check uid41 if it is an url):

plugin.tx_powermail_pi1 {
validate.uid41.expression = ^(http://)?([a-z0-9-]+\.)+([a-z0-9-]{2,3})$^
validate.uid41.errormsg = Sorry, but this is not a correct URL, try again!
}

You can enter any regulare expression go check your field values

Further regex examples:

plugin.tx_powermail_pi1 {
validate.uid23.expression = /^alex\@wunschtacho\.de$/
validate.uid23.errormsg = Sorry, but this field should contain alex@wunschtacho.de!

}

plugin.tx_powermail_pi1 {
validate.uid25.expression = /^###UID26###$/
validate.uid25.errormsg = Sorry, but your password fields are different – try again!

}

Saving db values to any db table

Introduction

With powermail you can save your values to any db table (e.g. fe_users or tt_address)

Example typoscript part in setup

plugin.tx_powermail_pi1 {

dbEntry.tt_address.uid41 = email

dbEntry.tt_address.uid65 = first_name

dbEntryDefault.tt_address.pid = [pid]

dbEntryDefault.tt_address.name = Alex Kellner

dbEntryDefault.tt_address.www = www.test.de

dbEntry.fe_users.uid41 = email

dbEntry.fe_users.uid65 = username,name

dbEntryDefault.fe_users.crdate = [tstamp]

dbEntryDefault.fe_users.tstamp = [tstamp]

}

Explanation of typoscript lines above

  1. Save content of uid41 in field “email” in table “tt_address”

  2. Save content of uid65 in field “first_name” in table “tt_address”

  3. Saves the current pid to the field “pid” in tt_address (e.g. 13)

  4. Always save “Alex Kellner” in field “name” in tt_address

  5. Always save “www .test.de” in field “www” in tt_address

  6. Save content of uid41 in field “email” in table “fe_users”

  7. Save content of uid65 in field “username” and in field “name” in table “fe_users”

  8. Save timestamp to field “crdate” in table “fe_users”

  9. Save timestamp to field “tstamp” in table “fe_users”

Some information about saving to other tables

  1. Saving is available only if table and field are existing

  2. Every table contains one record

  3. dbEntryDefault is only available with dbEntry

  4. You can save your values to more fields, when you separate your fields with comma (,)

  5. With this small add to powermail, you can use powermail for many features like guestbook form, tipafriend form, fe_user registration, tt_address registration and so on...

Fighting spam

  1. We suggest you to use the extension wt_spamshield for fighting spam entries (see details in manual wt_spamshield)

  2. You can also use captcha (see next paragraph)

Integrate captcha to your form

  1. First of all install a captcha extension like captcha or sr_freecap

  2. Be sure, that you have chosen this extension via constants (captcha or sr_freecap)

  3. As you can add a normal textfield, you can add a captcha field, thats all

  4. If you have installed captcha AND sr_freecap, the extension use sr_freecap

  5. If you have not installed one of this extensions, an error message in frontend is shown

Example: Using captcha

Example: Using sr_freecap