Git Product home page Git Product logo

formhandler's Introduction

TYPO3 Formhandler

Build rock solid, state of the art forms in TYPO3 the painless way.

Full documentation: https://formhandler.jakota.dev

Version of Formhandler for Typo3 v11.5.x

Support for Typo3 v11.5.x can be found as 8.x.x at:

https://packagist.org/packages/jakota/formhandler

or

https://github.com/JAK0TA/formhandler/tree/Typo3v11

And bug reports or MRs are still very welcome.

Full documentation: http://www.typo3-formhandler.com

Authors

The full file history with author names can be found at https://github.com/JAK0TA/formhandler

formhandler's People

Contributors

tlueder avatar nmantek avatar reinhardfuehricht avatar krohnmi avatar 7elix avatar sabbelasichon avatar jmverges avatar amphx avatar pulponair avatar luzat avatar schweriner avatar bmack avatar denislorch avatar marcoremy avatar mbrodala avatar svenjuergens avatar josefglatz avatar navsaj avatar gerberjakota avatar kaywalker avatar mgrn0 avatar

Stargazers

 avatar Frank Merl avatar  avatar  avatar

Watchers

 avatar  avatar

formhandler's Issues

Error when used in no-composer install (TYPO3 v11, formhandler v8.3.8)

Hi,

in composer.json under required is the PDF lib "tecnickcom/tcpdf": "^6.0".
When used in a no-composer install under TYPO3 v11, an error is thrown, because the required lib is not found.
Under Classes/Utility/ there is TemplateTCPDF.php (in v8.3.8). If I remove this file, it works.

Since in v9+ those utility classes files are gone anyway, is this a left-over or is a check for no-composer-mode missing somewhere?

In my case I don't need the TCPDF stuff, so this work-around, well, worksforme :-)

But what would be the "correct" way to provide the required libs in a non-composer environment?
(to make sure, I know that composer would be the better way anyway, but in this case I don't have a saying in this)

thanks for the fork and the work!

PreProcessor/LoadDefaultValues changed behaviour

Hi, der Issue ist etwas schwieriger zu erklären, daher einmal auf deutsch. Hoffe das ist in Ordnung.

Es geht mehr oder weniger um diese isset() Abfrage hier im PreProcessor/LoadDefaultValues.

Die Ausgangssituation ist:

Ein Formular, wo mit Hilfe von DefaultValue ein Feld mit 0 vordefiniert wird:

  preProcessors {
    1.class = PreProcessor\LoadDefaultValues
    1.config {
      1 {
        abc.defaultValue = 0
      }
    }
  }

Jetzt wurde im Formular eine TypoScript Bedingung gesetzt, das wenn die Seite mit dem Formular aufgerufen wird und ein URL Parameter vorhanden ist, dann soll das Feld 1 enthalten

[traverse(request.getQueryParams(), 'parameteranderurl') == 1]

      2.class = PreProcessor\LoadDefaultValues
      2.config {
        1 {
          abc.defaultValue = 1
        }
      }

[global]

Wenn wir nun im "PreProcessor/LoadDefaultValues" -> setDefaultValues sind, hat sich folgendes geändert:

Beim Aufruf der Funktion werden die Werte mit anderen ausgangswerten Übergeben:
Ursprünglich kam der Wert mit einem null wert an

array:1 [▼

  "abc" => null
]

Jetzt kommt der Wert mit einem leeren String an

array:1 [▼

  "abc" => ""
]

In der Funktion setDefaultValues wird das Array nun durchlaufen und wir kommen zu oben erwähnten Zeile 91
elseif (!isset($currentLevelGP[$fieldName])

Ursprünglich war der wert von abc NULL, somit war die isset(...)* Abfrage selbst false und durch die Negation true, jetzt wird aber gegen einen leeren String geprüft, somit ist isset(...) true und durch die Negation false
Und das Feld "abc" bleibt in dem Fall leer

isset — Prüft, ob eine Variable deklariert ist und sich von null unterscheidet

[BUG] Fileupload finisher type error

The StoreUploadedFiles finisher throws an type error when trying to rename a file because $GLOBALS['TSFE']->id, an int, is beeing used to replace in str_replace

Step to migrate from "phorax/formhandler" to "jakota/formhandler" in TYPO3 V11 and PHP 8

I try to replace the old form handler with the new one you you wrote but I can't find documentation, the documentation is not available on TER.

Are there a document explaining how to migrate from old extension "phorax/formhandler" to this one.

For example, it seems that this TypoScript configuration :

plugin.Tx_Formhandler.settings.predef {

have to be changed like this :

plugin.tx_formhandler_pi1.settings.predef {

Are there other migration to do ?

[Bug] Undefined array key

PHP Warning: Undefined array key "demand" in /typo3conf/ext/formhandler/Classes/Controller/ModuleController.php line 116

[BUG] strpos(): Argument #1 ($haystack) must be of type string, int given

hi,

i got this error in /formhandler/Classes/Utility/GeneralUtility.php line 992
Bildschirmfoto 2023-06-25 um 22 58 18

if i had a cssFile Definition like this:

plugin.Tx_Formhandler.settings.predef.formular {

  name = abc

  ...

  cssFile {
    10 = TEXT
    10.value = file1.css

    20 = TEXT
    20.value = file2.css

    30 = TEXT
    30.value = file3.css
  }

(1/1) TypeError Typoheads\Formhandler\Utility\GeneralUtility::getFilledLangMarkers(): Argument #1 ($template) must be of type string, int given, called in .../formhandler/Classes/Finisher/Mail.php on line 142

hi, i got this error.

problem seems this config, especially this option: "deleteGeneratedFiles = 1"

    1.class = Finisher\Mail
    1.config {
      checkBinaryCrLf = message
      admin {
        templateFile = TEXT
        templateFile.value = ...
        sender_email = ...

        to_email = ...
        subject = Kontaktaufnahme per Formular
        replyto_email = email
        cc_email = ...
        attachGeneratedFiles {
          1.class = MyNameSPace\Extension\Formhandler\Generator\ContactSheet
          1.config {
          ....
          }
        }
        deleteGeneratedFiles = 1
      }
    }

the error is triggered here:
Bildschirmfoto 2023-06-19 um 00 58 52
at this point i get the '1' as integer and so triggered the TypeError .

(1/1) TypeError strlen(): Argument #1 ($string) must be of type string, null given

hi,

found another one, in formhandler/Classes/Validator/ErrorCheck/FileMaxCount.php line 76
The problem occurs in a form with file upload.
My upload field is called photo and has the following errorCheck config:

            photo.errorCheck {
                1 = fileAllowedTypes
                1.allowedTypes = jpg,png
                2 = fileMaxSize
                2.maxSize = 8388608
                3 = fileMinSize
                3.minSize = 1048576
                4 = fileMaxCount
                4.maxCount = 1
                5 = fileRequired
            }

If I now fill out the form and leave the FormUpload field empty, it comes to this field.
Bildschirmfoto 2023-07-03 um 16 36 02

note: it's line 76 not 77, had a forgotten dump() in code

Error with form with checboxes (TYPO3 V11 and formhandler v8.3.10)

I have a form with check boxes like this:

Capture d’écran du 2024-01-23 15-41-24

the HTML used for this template is:

<!-- ###master_priva_check-info### -->
<div class="form-group ###required_info### ###is_error_info###">
    <fieldset>
        <legend>###LLL:label_info###</legend>
        <div class="form-check form-check-inline">
            <input type="checkbox" id="info_1" name="###formValuesPrefix###[info][]" value="1" ###checked_info_1###/>
            <label for="info_1">###LLL:label_info_1###</label>
        </div>
        <div class="form-check form-check-inline">
            <input type="checkbox" id="info_3" name="###formValuesPrefix###[info][]" value="3" ###checked_info_3###/>
            <label for="info_3">###LLL:label_info_3###</label>
        </div>
        <div class="form-check form-check-inline">
            <input type="checkbox" id="info_4" name="###formValuesPrefix###[info][]" value="4" ###checked_info_4###/>
            <label for="info_4">###LLL:label_info_4###</label>
        </div>
        <div class="form-check form-check-inline">
            <input type="checkbox" id="info_5" name="###formValuesPrefix###[info][]" value="5" ###checked_info_5###/>
            <label for="info_5">###LLL:label_info_5###</label>
        </div>
        <div class="form-check form-check-inline">
            <input type="checkbox" id="info_6" name="###formValuesPrefix###[info][]" value="6" ###checked_info_6###/>
            <label for="info_6">###LLL:label_info_6###</label>
        </div>
        <div class="form-check form-check-inline">
            <input type="checkbox" id="info_7" name="###formValuesPrefix###[info][]" value="7" ###checked_info_7###/>
            <label for="info_7">###LLL:label_info_7###</label>
        </div>
    </fieldset>
    ###error_info###
</div>
<!-- ###master_priva_check-info### -->


<!-- ###master_priva_show_info### -->
<div class="form-group">
    <label>###LLL:label_info### : </label>
    <ul>
        <!-- ###IF_info|0 = 1### -->
        <li>###LLL:label_info_1###</li>
        <!-- ###IF_info|0 = 1### -->
        <!-- ###IF_info|0 = 2 || info|1 = 2### -->
        <li>###LLL:label_info_2###</li>
        <!-- ###IF_info|0 = 2 || info|1 = 2### -->
        <!-- ###IF_info|0 = 3 || info|1 = 3 || info|2 = 3### -->
        <li>###LLL:label_info_3###</li>
        <!-- ###IF_info|0 = 3 || info|1 = 3 || info|2 = 3### -->
        <!-- ###IF_info|0 = 4 || info|1 = 4 || info|2 = 4 || info|3 = 4### -->
        <li>###LLL:label_info_4###</li>
        <!-- ###IF_info|0 = 4 || info|1 = 4|| info|2 = 4 || info|3 = 4### -->
        <!-- ###IF_info|0 = 5 || info|1 = 5|| info|2 = 5 || info|3 = 5 || info|4 = 5### -->
        <li>###LLL:label_info_5###</li>
        <!-- ###IF_info|0 = 5 || info|1 = 5 || info|2 = 5 || info|3 = 5 || info|4 = 5### -->
        <!-- ###IF_info|0 = 6 || info|1 = 6 || info|2 = 6 || info|3 = 6 || info|4 = 6 || info|5 = 6### -->
        <li>###LLL:label_info_6###</li>
        <!-- ###IF_info|0 = 6 || info|1 = 6 || info|2 = 6 || info|3 = 6 || info|4 = 6 || info|5 = 6### -->
        <!-- ###IF_info|0 = 7 || info|1 = 7 || info|2 = 7 || info|3 = 7 || info|4 = 7 || info|5 = 7 || info|6 = 7### -->
        <li>###LLL:label_info_7###</li>
        <!-- ###IF_info|0 = 7 || info|1 = 7 || info|2 = 7 || info|3 = 7 || info|4 = 7 || info|5 = 7 || info|6 = 7### -->
    </ul>
</div>
<!-- ###master_priva_show_info### -->

then, I have this error:

PHP Warning: Undefined array key 3 in /production/www/clients/www.musee-armee.fr/site/web/typo3conf/ext/formhandler/Classes/Utility/GeneralUtility.php line 600

This is because in method GeneralUtility::getGlobal(), the existence of the index is not checked, line 600 should be:

      } elseif (is_array($value)) {
        $value = $value[$currentKey] ?? '';
      } else {

and also, the mail sent has empty data for check boxes - while other data type are good - the email template is like this:

###LLL:label_tel### : ###value_tel###
###LLL:label_info### : ###value_info###
###LLL:label_date### : ###value_date###
###LLL:label_manif### : ###value_manif###
###LLL:label_presta### : ###value_presta###

Capture d’écran du 2024-01-23 15-34-43

The template worked with phorax/formhandler.

Formhandler TypoScript configuration:


plugin.tx_formhandler_pi1.settings.predef.privatisation {

    ...
  
    markers {
        n_label_info = USER
        n_label_info {
            field = info
            locallang = LLL:EXT:my_ext/Resources/Private/Templates/Formhandler/privatisation/locallang.xlf:label_info_
            userFunc = FormhandlerUserFunc->getLangCheck
        }
    }

    ...
}

Thanks for your help and correction in getGlobal() method.

[Bug] Ajax requests aren't working anymore

Typoheads\Formhandler\Component\AbstractClass::__construct(): Argument #2 ($configuration) must be of type Typoheads\Formhandler\Controller\Configuration, Typoheads\Formhandler\Utility\Globals given, called in /var/www/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3221
Stacktrace:
-> in /var/www/public/typo3conf/ext/formhandler/Classes/Component/AbstractClass.php line 87
-> in /var/www/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 3221
-> in /var/www/public/typo3conf/ext/formhandler/Classes/Middleware/AjaxMiddleware.php line 206
-> in /var/www/public/typo3conf/ext/formhandler/Classes/Middleware/AjaxMiddleware.php line 156
-> in /var/www/public/typo3conf/ext/formhandler/Classes/Middleware/AjaxMiddleware.php line 72

(v11) 503 error in TYPO3 DB-Manager Tool

substr(): Argument #1 ($string) must be of type string, null given

This error happens if one tries to use the dbmanager -> full search -> advanced query and selects the formhandler_log database table.

Bildschirmfoto 2024-05-15 um 16 16 47

The error is thrown by TYPO3 core's Database / Query -> Querybuilder, which is looking for a ".*" substring (-2) of whatever it thinks is used to create the xxxx in SELECT xxxx FROM...

https://github.com/TYPO3/typo3/blob/331443140cffa5075e16e8b79f4afbd8fc13219e/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php#L1194

I've seen the other (closed) issues where the same error appeared in other places and were fixed by modifying the cast to string thingie.
Since this now seems to error in one of the TYPO3 core parts, I have no idea how to fix this :-/
I don't even know what this query builder method expects as it's first argument which has to be a string (b/c of the substring() used) and what seems to be there with the other db-tables that the dbmanager tool offers (pages, users, sys_log etc, basically every table present in the typo3 database)

Missing Setting of 'formUrl' Parameter in JSON

Description:
The problem currently being faced is that the 'formUrl' parameter is not being set in the JSON data as expected. This is leading to unexpected behavior and errors in the application, f. e. an empty json response on form submit.

Context:
This problem particularly arises when the plugin is not located on the rootpage of the website.

Error when adding multiple language files

With TYPO3 V11 and formhandler version 8.3.9, if you want to add multiple language files like this:

plugin.tx_formhandler_pi1.settings.predef.privatisation {
    langFile {
        1 = EXT:my_ext/Resources/Private/Templates/Formhandler/masterlocallang.xlf
        2 = EXT:my_extResources/Private/Templates/Formhandler/privatisation/locallang.xlf
    }
}

then an error is thrown:

PHP Warning: Undefined array key "1." in /production/www/clients/www.musee-armee.fr/site/web/typo3conf/ext/formhandler/Classes/Utility/GeneralUtility.php line 1122'

It's because in file formhandler/Classes/Utility/GeneralUtility.php, function readLanguageFiles(), this code should be change from this:

foreach ($settings['langFile.'] as $key => $langFile) {
  if (false === strpos((string) $key, '.')) {
    if (is_array($settings['langFile.'][$key.'.'])) {
      array_push($langFiles, self::getSingle($settings['langFile.'], $key));
    } else {
      array_push($langFiles, self::resolveRelPathFromSiteRoot($langFile));
    }
  }
}

to something like this I guess:

foreach ($settings['langFile.'] as $key => $langFile) {
      array_push($langFiles, self::resolveRelPathFromSiteRoot($langFile));
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.