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:
Mandatory
URL
Numbers
Numbers (with comma or point)
Letters
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:
If error in inputfields: <input class=“validation-failed” />
If no error in inputfields: <input class=“validation-passed” />
DIV Layer of errormessage: <div class=”powermail_mandatory_js”>error</div>
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:
email: check if value is an email
url: check if value is a correct url
numbers: only numbers allowed
phone: numbers and / and + and - allowed
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!
}
plugin.tx_powermail_pi1 {
# 1. tt_address entry
# allow import
dbEntry.tt_address.enable = TEXT
dbEntry.tt_address.enable.value = 1
# values from session
dbEntry.tt_address.uid41 = email
dbEntry.tt_address.uid65 = first_name
# static values from ts
dbEntryDefault.tt_address.pid = TEXT
dbEntryDefault.tt_address.pid.field = uid
dbEntryDefault.tt_address.name = TEXT
dbEntryDefault.tt_address.name.value = Alex Kellner
dbEntryDefault.tt_address.tstamp = TEXT
dbEntryDefault.tt_address.tstamp.data = date:U
# 2. fe_users entry
# values from session
dbEntry.fe_users.uid41 = email
dbEntry.fe_users.uid65 = username,name
# static values from ts
dbEntryDefault.fe_users.crdate = TEXT
dbEntryDefault.fe_users.crdate.data = date:U
}
“enable” = TEXT
enable tt_address db import (default is 1) – you can disallow db import via typoscript if you want
Save content of uid41 in field “email” in table “tt_address”
Save content of uid65 in field “first_name” in table “tt_address”
“pid” is TEXT
Saves the current pid to the field “pid” in tt_address (e.g. 13)
“name” is TEXT
Always save “Alex Kellner” in field “name” in tt_address
“tstamp” is TEXT
Always save current timestamp to field “tstamp” in tt_address
Save content of uid41 in field “email” in table “fe_users”
Save content of uid65 in field “username” and in field “name” in table “fe_users”
“crdate” is TEXT
Save timestamp to field “crdate” in table “fe_users”
Saving is available only if table and field are existing
Typoscript is available for static values (TEXT, USER, etc...)
Every table contains one record
dbEntryDefault is only available with dbEntry
You can save your values to more fields, when you separate your fields with comma (,)
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...
Is there a fitting piVar like &tx_powermail_pi1[uid11]=text, than use this value, and if not...
Is there a value in the session, so fill field with this value, and if not...
Is there a value set in the backend flexform, take this value, and if not...
Should this field filled with logged in fe_user datas (set in backend), take this value, and if not...
Was typoscript used to prefill a field, use this (see example below), and if not
Don't fill
plugin.tx_powermail_pi1 {
prefill {
# fill field uid997 with a static text
uid997 = TEXT
uid997.value = example value
# fill field uid998 with current timestamp
uid998 = TEXT
uid998.data = date:U
# fill field uid998 with current date like "Date: 20.01.2009"
uid996 = TEXT
uid996.data = date:U
uid996.strftime = Date: %d.%m.%Y
# fill field uid995 with IP address of the user
uid995 = TEXT
uid995.data = getIndpEnv:REMOTE_ADDR
}
}
Maybe it's usefull to fill some hidden fields with hidden but important values (IP address, timestamp, Language, GET params, etc..)
We suggest you to use the extension wt_spamshield for fighting spam entries (see details in manual wt_spamshield)
You can also use captcha (see next paragraph)
First of all install a captcha extension like captcha or sr_freecap
Be sure, that you have chosen this extension via constants (captcha or sr_freecap)
As you can add a normal textfield, you can add a captcha field, thats all
If you have installed captcha AND sr_freecap, the extension use sr_freecap
If you have not installed one of this extensions, an error message in frontend is shown
Example: Using captcha
Example: Using sr_freecap