Following steps to reproduce:

- install Paragraphs module and Better Formats module
- create paragraph type with a formatted long text field
- create content type with paragraphs reference
- create a node, add a paragraph with the textfield and try to save the node

Result:
An error message "This value should not be null. " shows up and the the text filter select field under the paragraphs textfield is marked red although there is a valid value chosen. This does not appear to be an issue on textfields added to the content type directly.

When Better Format module is deinstalled the node can be saved without problems

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tobiberlin created an issue. See original summary.

jonathanshaw’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce that. Works fine for me.

Can you reproduce in a clean environment like simplytest.me with the latest paragraphs dev?

tobiberlin’s picture

Project: Paragraphs » Better Formats
Version: 8.x-1.0-rc4 » 8.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

I change this issue as it seems that it belongs to Better Formats module.

In my installation I tried Better Formats and when I deinstall this module the problem disappears. I was already confused when I checked the values in $form_state as the values of the textfield seem to disappear in values array when Better Formats module is enabled. I did not go deeper into your code but for me it seems that there is something wrong?!

I edit the above steps to reproduce the problem

tobiberlin’s picture

Issue summary: View changes

edited steps to reproduce the problem

tobiberlin’s picture

Title: This value should not be null error message when long formatted textfield is used within paragraph » Text fields empty after saving a form

Found the problem. First of all it was not just related to paragraphs: the real problem was that no values were saved for the text fields and in my local installation only the paragraphs field was required. This was the only reason why the error message just appeared with this field. But for no textfield the value were saved

What I found out and changed: in better_formats_filter_process_format() in line 49 of the module file you use array_shift() to get the field name. This cuts out the first element of the $element['#parents'] and leads to some strange values in $form_state['values']

So I changed this as you can see in my commit. This solved my issue.

tobiberlin’s picture

Added patch

Please see that in line 54 the same array_slice() method is used but I have no time to go deeper into this case.

justAChris’s picture

Status: Active » Needs review
Related issues: +#2709313: BF field is not validating

Looks like a duplicate of #2709313: BF field is not validating. Leaving this open for now as the patch does contain a different solution.

Setting to Needs Review as a valid patch is provided.

Regarding line 54:

$default_value = array_shift($field_defaults);

This should be ok since $field_defaults isn't used after this line.

rolfmeijer’s picture

The patch of #6 did solve my issue with fields being empty.

rolfmeijer’s picture

Because the patches of #2728477: 500 error on add taxonomy term form submit (comment 2) and this issue (comment 6) are related to the same block of code, those patches cannot be used together. So I combined them into a single patch.

rolfmeijer’s picture

Devin Carlson’s picture

Status: Needs review » Closed (duplicate)

Marking as a duplicate of #2709313: BF field is not validating.