Skip to content

Commit

Permalink
adjust code to not emit any html
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Mar 6, 2025
1 parent ea15c85 commit 49db9db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demos/form-control/tree-item-selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
$control->set([201, 301, 503]);

$control->onItem(static function (array $values) use ($pathFromIdFx, $items) {
return new JsToast('Selected: ' . implode(',<br>', array_map(static fn ($v) => $pathFromIdFx($items, $v), $values)));
return new JsToast('Selected: ' . implode(', ', array_map(static fn ($v) => $pathFromIdFx($items, $v), $values)));
});

$control = $form->addControl('tree1', [Form\Control\TreeItemSelector::class, 'treeItems' => $items, 'allowMultiple' => false, 'caption' => 'Single selection:']);
Expand Down
2 changes: 1 addition & 1 deletion demos/form/form-section.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

return new JsToast([
'title' => 'POSTed field values',
'message' => '<pre>' . $form->getApp()->encodeJson($form->entity->get()) . '</pre>',
'message' => $form->getApp()->encodeJson(array_diff_key($form->entity->get(), [$form->entity->idField => true])),
'class' => 'success',
'displayTime' => 5000,
]);
Expand Down
4 changes: 2 additions & 2 deletions demos/form/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
$form->buttonSave->set('Compare Date');

$form->onSubmit(static function (Form $form) {
$message = 'field = ' . print_r($form->entity->get('field'), true) . '; <br> control = ' . print_r($form->entity->get('control'), true);
$messageHtml = 'field = ' . print_r($form->entity->get('field'), true) . '; <br> control = ' . print_r($form->entity->get('control'), true);
$view = new Message('Date field vs control:');
$view->setApp($form->getApp());
$view->invokeInit();
$view->text->dangerouslyAddHtml($message);
$view->text->dangerouslyAddHtml($messageHtml);

return $view;
});
Expand Down

0 comments on commit 49db9db

Please sign in to comment.