Custom TCA validations in TYPO3 - typo3

How do I create a custom validation for a TCA field? We want to check the input of a textfield with an AJAX-request. So it should be done with JS. If I check the FormEngineValidation.js it seems there is no option for using custom validators.
Is that right? Or did I miss something?
Version: TYPO3 CMS 7LTS

The 'eval' api of FormEngine is still rather ugly.
ext:styleguide brings an example for input_21 that adds some JS magic using returnFieldJS(), this may or may not be enough for your use case.
https://github.com/TYPO3/styleguide/blob/master/Classes/UserFunctions/FormEngine/TypeInput21Eval.php

Related

Is it possible to configure the wizard in TCA so that I can create a new particular plugin?

How can I create a custom wizard in TCA so that, I can click on add button to create a particluar specific plugin on a page? my TYPO3 Version is 7.6.
click on the image. There is a add button
You can make a custom wizard on your own or use an existing one. Here you can find examples of existing ones and an example to create a custom one: https://docs.typo3.org/typo3cms/TCAReference/7.6/AdditionalFeatures/WizardsConfiguration/Index.html#user-defined-wizard-processing-with-php-function
Note this code area has been rewritten with core v8 - much more powerful 'wizards' are possible, called 'node expansion' and they come with a better API. For details see https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/FormEngine/Rendering/Index.html#node-expansion and the according sections from TCA Reference for details.

RTE in own backend module based on Extbase and Fluid

for a complex structure of a domain model (lots of fields and some relations) it´s planned to write an own backend module to be more flexible according to the structure and usability of that module. And there are some dependencies of some fields which I think I cannot make it just via TCA resp. FlexForms. So one thing I hope someone has done that before: If I build an own BE module with extbase and Fluid etc. and have forms with input fields or better textfields:
How can I add an RTE to such a field? Is that possible? I´ve read the TYPO3 Extbase book, but the example there do not contain a RTE.
in case you would like to use the same RTE as TYPO3 it is quite difficult to add all required scripts including the configuration of RTE to a field and I can't help you with that.
But I would like to remember you that in TYPO3 8 LTS the ckeditor becomes the new TYPO3 editor. So you may look forward to directly use it in your backend module or check out the docs of 8 LTS regarding the usage of it on own fields (if any docs exists yet).
http://ckeditor.com/

How to add captcha to Typo3 FORM cObj?

According to the official form extension documentation, there is a CAPTCHA FormObject:
This object will search for an installed captcha extension and use it
at the position where it is put in the form. This can be on top, but
also at the bottom of the form. Currently all (correct me if I'm wrong
here) captcha extensions are supported.
However, I wasn't able to use it in my form. There is not captcha item in the form wizard, even if I explicitly add it to the PageTS config. When I manually try to add a captcha to my form, nothing happens.
Did anybody succeed adding a captcha to a form built using the (not so) new form extension?
Instead of using a captcha, I recommend installing https://typo3.org/extensions/repository/view/wt_spamshield. This extensions supports the old and the new form extension of TYPO3 up to 6.2. This extensions adds different, invisible form protections which are more powerful than the unreadable captchas ;)
IMHO the new form extension (EXT:form) does not support any captcha extension.

add Validator to existing FormItem Validators in smartgwt

in a smartgwt DynamicForm, how can I add a validator to an existing set of validators within a FormItem ?
The only method I found in the official api is "setValidator(Validator)", but this seems to overwrite all the existing ones.
I would prefer a java approach to this (i.e. using smartgwt api), but in the end, if no solutions are available, at least a "js" native method would do the job.
thanks
Most likely, you don't want to by trying to dynamically add a validator at all.
First, read the Data Binding section of the QuickStart Guide, which shows how you can add screen-specific validators to a form while still inheriting validators declared in the DataSource.
Second, if you're trying to dynamically change the list of validators because some data that validation depends on is changing, take a look at the CustomValidator instead.
If you have some reason to add a validator dynamically that isn't handled by these approaches, try explaining it in detail.
Finally, you can continue with your current approach (not recommended) if you just refactor such that you can provide all the appropriate validators to the FormItems in a single setValidators() call.

Should I generate html form?

I'm building a php application that will have many modules/plugins. The issue is that creating smarty template for form's of each plugin and writing validation code for each looks redundant and at the same time using PHP to generate form will restrict the flexibility in controlling each form's layout structure the way I would have wanted.
Using PHP classes and inheritance you can write the validation and layout code once and overriding them whenever you need specific behaviour.