Skip to content

Commit

Permalink
fix(fieldsfield): required property update on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Jun 10, 2024
1 parent 8011971 commit feb1de0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ajax/question_design.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,7 @@
$question->fields['fieldtype'] = '';
if ($field !== null) {
$question->fields['fieldtype'] = $_REQUEST['fieldtype'];
$question->fields['_blocks_field'] = $_REQUEST['blocks_field'] ?? null;
$question->fields['_dropdown_fields_field'] = $_REQUEST['dropdown_fields_field'] ?? null;
}
$question->showForm($question->getID());
2 changes: 1 addition & 1 deletion inc/field/fieldsfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FieldsField extends PluginFormcreatorAbstractField
public function getField(): ?PluginFieldsField {
if ($this->field === null && isset($this->question->fields['values'])) {
$decodedValues = json_decode($this->question->fields['values'], JSON_OBJECT_AS_ARRAY);
$field_name = $decodedValues['dropdown_fields_field'] ?? '';
$field_name = $decodedValues['dropdown_fields_field'] ?? ($this->question->fields['_field_name'] ?? '');
$fieldObj = new PluginFieldsField();
if ($fieldObj->getFromDBByCrit(['name' => $field_name])) {
$this->field = $fieldObj;
Expand Down
1 change: 1 addition & 0 deletions templates/field/fieldsfield.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
item.fields['_field_list'],
item.fields['_drodpdown_field_label'],
{
on_change: 'plugin_formcreator.changeQuestionType(this)',
display_emptychoice: true,
label_class: 'col-xxl-4',
input_class: 'col-xxl-8',
Expand Down

0 comments on commit feb1de0

Please sign in to comment.