Skip to content

Commit

Permalink
Merge pull request #92 from bcgov/Fix-placeholder-and-helperText-in-J…
Browse files Browse the repository at this point in the history
…SON-ADO-2312

Fix placeholder and helperText in JSON
  • Loading branch information
saranyaviswam authored Jan 30, 2025
2 parents cf0b72d + 643cb51 commit e1c0cfb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/Helpers/FormTemplateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected static function formatField($fieldInstance, $index)
"type" => $field->dataType->name,
"id" => $fieldInstance->custom_instance_id ?? $fieldInstance->instance_id,
"label" => $label,
"helpText" => $fieldInstance->custom_help_text ?? $field->help_text,
"helperText" => $fieldInstance->custom_help_text ?? $field->help_text,
"styles" => $fieldInstance->custom_styles ?? $field->styles,
"mask" => $fieldInstance->custom_mask ?? $field->mask,
"codeContext" => [
Expand All @@ -148,19 +148,17 @@ protected static function formatField($fieldInstance, $index)
switch ($field->dataType->name) {
case "text-input":
return array_merge($base, [
"placeholder" => "Enter your {$fieldInstance->label}",
"helperText" => "{$fieldInstance->label} as it appears on official documents",
"inputType" => "text",
]);
case "dropdown":
$label = $fieldInstance->custom_label ?? $fieldInstance->formField->label;
return array_merge($base, [
"placeholder" => "Select your {$fieldInstance->label}",
"placeholder" => "Select your {$label}",
"isMulti" => false,
"isInline" => false,
"selectionFeedback" => "top-after-reopen",
"direction" => "bottom",
"size" => "md",
"helperText" => "Choose one from the list",
"listItems" => $field->selectOptions()
->get()
->map(function ($selectOption) {
Expand All @@ -171,11 +169,9 @@ protected static function formatField($fieldInstance, $index)
case "text-info":
return array_merge($base, [
"value" => $fieldInstance->formInstanceFieldValue?->custom_value ?? $field->formFieldValue?->value,
"helperText" => "{$fieldInstance->label} as it appears on official documents",
]);
case "radio":
return array_merge($base, [
"helperText" => "Choose one option",
"listItems" => $field->selectOptions()
->get()
->map(function ($selectOption) {
Expand Down

0 comments on commit e1c0cfb

Please sign in to comment.