In new component for form submissions, there is probably problem with rendering for fields, when there is no type: hidden but it is just hidden: true … on frontend it may render input type hidden, right? but renders all
not working any of these
competition:
type: text
label: Súťaž
defaultFrom: this.page.title
hiden: true
hidden: true
readOnly: true
attributes:
hidden: true
Update
When i checked component for submissioncomponent, there are multiple problems.
- properties from yaml are not sent to field
{
"name":"competition",
"label":"S\u00fa\u0165a\u017e",
"type":"text",
"htmlType":"text",
"options":[],
"required":false,
"placeholder":"",
"comment":"",
"multiple":false
}
As you can see, there are missing hidden: … or any kind of settings from yaml, for example ‘hidden’, ‘readonly’ nor attributes are pushed into field …
wrong part is probably this config in cms\behaviors\FormComponent
$fields[] = [
'name' => $name,
'label' => __($field['label'] ?? $name),
'type' => $type,
'htmlType' => $htmlType,
'options' => $field['options'] ?? [],
'required' => $isRequired,
'placeholder' => __($field['placeholder'] ?? ''),
'comment' => __($field['comment'] ?? ''),
'multiple' => $htmlType === 'file' && (int) ($field['maxFiles'] ?? 0) !== 1,
];
- template for rendering has no check for existence of ‘hidden’ then when hidden is set, is ignored as well…
{% if formSubmitted %}
<div class="alert alert-success">
{{ formSuccessMessage|default('Thank you for your submission!') }}
</div>
{% else %}
{% for field in fields %}
{% if field.htmlType == 'textarea' %}
....
there is no check for {% if field.hidden != true %} that will ‘skip’ whole rendering.
- trying to solve, where is defined
formSuccessMessagebecause, always fallbacks todefault…
Tried to use{% component 'submission' formSuccessMessage=... %}not really affecting result, always shows default message. lookup inside whole codebase, there is no configuration for component that will fill-up this variable, or anything…