Skip to content

Commit 3dd99f8

Browse files
committed
fix(fieldsfield): required property update on UI
1 parent 8011971 commit 3dd99f8

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

ajax/question_design.php

+2
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,7 @@
6969
$question->fields['fieldtype'] = '';
7070
if ($field !== null) {
7171
$question->fields['fieldtype'] = $_REQUEST['fieldtype'];
72+
$question->fields['_blocks_field'] = $_REQUEST['blocks_field'] ?? null;
73+
$question->fields['_dropdown_fields_field'] = $_REQUEST['dropdown_fields_field'] ?? null;
7274
}
7375
$question->showForm($question->getID());

inc/field/fieldsfield.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class FieldsField extends PluginFormcreatorAbstractField
6363
public function getField(): ?PluginFieldsField {
6464
if ($this->field === null && isset($this->question->fields['values'])) {
6565
$decodedValues = json_decode($this->question->fields['values'], JSON_OBJECT_AS_ARRAY);
66-
$field_name = $decodedValues['dropdown_fields_field'] ?? '';
66+
$field_name = $decodedValues['dropdown_fields_field'] ?? ($this->question->fields['_field_name'] ?? '');
6767
$fieldObj = new PluginFieldsField();
6868
if ($fieldObj->getFromDBByCrit(['name' => $field_name])) {
6969
$this->field = $fieldObj;

templates/field/fieldsfield.html.twig

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
item.fields['_field_list'],
6060
item.fields['_drodpdown_field_label'],
6161
{
62+
on_change: 'plugin_formcreator.changeQuestionType(this)',
6263
display_emptychoice: true,
6364
label_class: 'col-xxl-4',
6465
input_class: 'col-xxl-8',

0 commit comments

Comments
 (0)