Task #39204
how to add a new validation rule for input, textarea etc.
| Status: | On Hold | Start date: | 2012-07-24 | |
|---|---|---|---|---|
| Priority: | Could have | Due date: | ||
| Assignee: | Dominic Garms | % Done: | 0% |
|
| Category: | Frontend Plugin | |||
| Target version: | Waiting for Sponsoring | |||
| Votes: | 0 |
Description
Hello,
as far as I understood the manual I tried to add own JavaScript Validation. But how do I insert the funcCall[myValidator] into the class of the validation?
I tried to add a Item in the
<>
TSFEFORM.tx_powermail_domain_model_fields.validation.addItems.equals[test] = Test Validation
but realised that its not possible to do it this way.
Is it possible, to get custom validation into the input, select, textarea fields?
Best Regards
History
Updated by Alex Kellner 10 months ago
- Category set to Frontend Plugin
- Status changed from New to Needs Feedback
- Assignee set to Dominic Garms
- Target version set to 2.x
I did it in another extension (same jQuery Plugin) in this way:
// HTML Template <f:form.textfield property="email" id="email" class="validate[required,custom[email],funcCall[dublicatecheck]]" />
// JavaScript
/**
* Field Element
*
* @param field
* @param rules
* @param i
* @param options
*/
function dublicatecheck(field, rules, i, optionsValidation) {
error = 1;
if (error) {
return 'Error';
}
}
Updated by Dominic Garms 10 months ago
Hello,
I want to use the input or select fields provided by powermail. Do I need to take custom html for getting additional Validators into the form?
Thanks
Updated by Alex Kellner 10 months ago
- Status changed from Needs Feedback to On Hold
- Target version changed from 2.x to Waiting for Sponsoring
Now I got you
You should extend powermail validation in backend by using TSconfig:
TSFEFORM.tx_powermail_domain_model_fields.validation.addItems.equals[test] = New Validation
After this a css-class
class="funcCall[test]]"
should be added automaticly
Now it would be possible to use an own JavaScript UserFunc
function test(field, rules, i, optionsValidation) {
return 'Error';
}
This is really I good idea, but I'm not sure if I can add this in the next days, so I will push this request to "Waiting for Sponsoring"
Updated by Dominic Garms 10 months ago
The problem I found out already is:
TSFEFORM.tx_powermail_domain_model_fields.validation.addItems.equals[test]
is invalid for the TCEFORM and doesn't make the way into the backend, it gets ignored. So there must be a different way to scale this for the TSFEFORM
I also thought if it might be a good idea of making the validator and css multiselect, then you can always use more then one validation / css class. Would be keen to implement this, Ill contact you when I get the time for it.
Updated by Alex Kellner 10 months ago
Thx Dominic
Updated by Christoph Ascherl 8 months ago
Could you please add a short description how to integrate a JavaScript validator? How can I configure that a class like class="validate[funcCall[myCheck]]" for a given input field will be generated?