Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access values from form #3

Open
mat1010 opened this issue Aug 3, 2016 · 3 comments
Open

How to access values from form #3

mat1010 opened this issue Aug 3, 2016 · 3 comments
Labels

Comments

@mat1010
Copy link

mat1010 commented Aug 3, 2016

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

@DanielSiepmann DanielSiepmann self-assigned this Aug 4, 2016
@DanielSiepmann
Copy link
Contributor

DanielSiepmann commented Aug 4, 2016

Our documentation is not that huge at the moment. I can't promise to change that in the near future.

You don't have to configure the fields. Only fields with fixed values like pid or hidden.

All other fields have to be named like the column. So if your form has a field field1 and field2 their values will be inserted into the column.

By providing the configuration

field1 = firstName
field2 = surName

you're telling the extension to insert this values into the columns.

Best would be to change the column names to firstName and surName to match naming full names already used in your form.

We have tried to reduce the overhead as much as possible. That's why you can't configure this.

Hopefully that will help you. If not, just answer or contact me via https://typo3.slack.com/messages/@danielsiepmann/

@DanielSiepmann
Copy link
Contributor

The issue is that you are using FIELDSET around the fields.
That's currently not supported.

I'll try to add this asap.

DanielSiepmann pushed a commit that referenced this issue Aug 4, 2016
* As fields can be nested inside of fieldsets and we didn't respect this
  depth

Resolves: #3
@DanielSiepmann
Copy link
Contributor

@mat1010 can you check whether it works with the fix?
You need to checkout the corresponding branch.

If so, I'll release a new version.

DanielSiepmann pushed a commit that referenced this issue Aug 4, 2016
* As fields can be nested inside of fieldsets and we didn't respect this
  depth

Resolves: #3
DanielSiepmann pushed a commit that referenced this issue Aug 22, 2016
…vide-hashing to develop

* commit '8ffdb840c9d01e7f6f018622e9faeb3f270a56a4':
  [CLEANUP] Fix indentation
  [FEATURE] Provide hashing post processor
@DanielSiepmann DanielSiepmann removed their assignment Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants