typo3typoscriptpowermail

Is it possible to set a default value for checkboxes in Powermail?


I would like to transmit yes or no as value for checkboxes in Powermail (marketing.sendpost.values). If the checkbox is not selected, nothing is transmitted by default. Is it possible to set a default value per checkbox? I have created the checkbox with Text|yes in TYPO3.

My TypoScript

300 = TEXT
300 {
   data = GP:tx_powermail_pi1|field|testcheckbox|0
   stdWrap {
       required = 1
       wrap = &testcheckbox=|
    }
    ifEmpty.wrap = &testcheckbox=no
}

but this does not work yet. The default value is used, but the empty field is also transmitted. e.g. Checkbox checked:

&testcheckbox=yes

Checkbox not checked

&testcheckbox=&testcheckbox=no

Why does it take the &testcheckbox= in the empty checkbox?


Solution

  • I have found a solution that works. Maybe it helps someone else.

    300 = TEXT
    300 {
        value = &testcheckbox=no
        override {
            cObject = TEXT
            cObject {
                required = 1
                data = GP:tx_powermail_pi1|field|testcheckbox|0
                wrap = &testcheckbox=|
            }
        }
    }