Skip to content

How to access values from form #3

@mat1010

Description

@mat1010

Hi,

could you provide an example on how to access the values of a forms input fields with this module?
When I submit my form with the postProcessor WebVision\WvFormDbInsert\Form\PostProcessor\DbInsert the values in the database are always the names of the for field since it seems the fields can't be proplery accessed. Here's a rough example of my form:

postProcessor {
    1 = mail
    1 {
        [...]
    }
    2 = WebVision\WvFormDbInsert\Form\PostProcessor\DbInsert
    2 {
        tableName = fooBar
        columns {
                        pid = 42
                        field1 = firstName
                        field2 = surName
        }
    }
}
10 = FIELDSET
10 {
    10 = TEXTLINE
    10 {
        type = text
        name = firstName
        label {
            value = Firstname
        }
    }
    20 = TEXTLINE
    20 {
        type = text
        name = surName
        placeholder = Surname
        label {
            value = Surname
        }
    }
}
[...]
30 = SUBMIT
30 {
    type = submit
    class = button
    name = 11
    value = Submit
}

Content of my typo3conf/ext/wv_form_db_insert/Configuration/TCA/fooBar.php:

<?php
if (!defined ('TYPO3_MODE')) {
        die ('Access denied.');
}

$GLOBALS['TCA']['fooBar'] = array(
        'ctrl' => array(
                'label' => '',
                'hideTable' => 0,
        ),
        'columns' => array(
                'uid' => array(
                        'label' => '',
                        'config' => array(
                                'type' => 'input',
                                'default' => 0,
                                'eval' => 'int,required'
                        )
                ),
                'pid' => array(
                        'label' => '',
                        'config' => array(
                                'type' => 'input',
                                'default' => 0,
                                'eval' => 'int,required'
                        )
                ),
               'field1' => array(
                        'label' => '',
                        'config' => array(
                                'type' => 'input',
                        )
                ),
                'field2' => array(
                        'label' => '',
                        'config' => array(
                                'type' => 'input',
                        )
                ),
);
?>

Content in database - instead of field values only the field names are inserted:

mysql> SELECT * FROM `fooBar`;
+-----+-----+------------+---------------+
| uid | pid | field1 | field2|
+-----+-----+------------+---------------+
|   1 |  42 | firstName       | surName | 
|   2 |  42 | firstName       | surName |
|   3 |  42 | firstName       | surName |
+-----+-----+------------+---------------+

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions