Enrique Moreno Tent
Enrique Moreno Tent

Reputation: 25267

TYPO3 - Adding values to a table using powermail

I made a form so that users can register their email address for a contest. Im using a powermail form and someone told me to use dbEntry to do this, but im not sure how to do it. This is my code so far:

plugin.tx_powermail_pi1{
    dbEntry{

        tt_address._enable = TEXT
        tt_address._enable.value = 1

        tt_address.email = TEXT
        tt_address.email.value = ????
    }

    debug.output = all
}​

Ive been told to activate _enable to enable the data insertion. But now I dont know how to access the field value of the form. I probably should use the template id, which is ###UID71###, but I have no idea how.

Upvotes: 1

Views: 2612

Answers (1)

Michael
Michael

Reputation: 2331

According to the official documentation, you can do it this way:

plugin.tx_powermail.settings.setup {
    dbEntry {
        # enable or disable db entry for tt_address
        tt_address._enable = TEXT
        tt_address._enable.value = 1

        # write only if field email is not yet filled with current value
        # (update: update values of existing entry)
        # (none: no entry if field is filled)
        # (disable: always add values don't care about existing values)
        tt_address._ifUnique.email = update

        # fill table "tt_address" with field "pid" with the current pid (e.g. 12)
        tt_address.pid = TEXT
        tt_address.pid.data = TSFE:id

        # fill table "tt_address" with field "tstamp" with the current time as timestamp (like 123456789)
        tt_address.tstamp = TEXT
        tt_address.tstamp.data = date:U

        # fill table "tt_address" with field "name" with the value from powermail {firstname}
        tt_address.name = TEXT
        tt_address.name.field = firstname

        ...
    }
}

I also found an (older) forum post (in German) with examples that use data from the user session:

# table "tt_address" with field "last_name" is the value from powermail (tt_content uid 88) field uid18 (###uid18###)
tt_address.last_name = TEXT
tt_address.last_name.data = TSFE:fe_user|sesData|powermail_88|uid18

Upvotes: 2

Related Questions