Skip to content

html in DefaultField HelpText Error #5119

@chrillep

Description

@chrillep
  • Laravel Version: 9-41
  • Nova Version: 4.19.3
  • PHP Version: 8.1.12
  • Database Driver & Version: mysql 8.0
  • Operating System and Version: alpine
  • Browser type and version: chrome 107.0.5304.110
  • Reproduction Repository: https://github.com/###/###

Description:

Happy friday! :)
we used line breaks in the error helptext
since nova 4, the help error text cannot be displayed as html.
FirstError is not v-html
it would be nice if both HelpText and HelpText Error work the same
https://nova.laravel.com/docs/4.0/resources/fields.html#field-help-text

      <HelpText class="mt-2 help-text-error" v-if="showErrors && hasError">
        {{ firstError }}
      </HelpText>

      <HelpText
        class="help-text mt-2"
        v-if="shouldShowHelpText"
        v-html="field.helpText"
      />

Detailed steps to reproduce the issue on a fresh Nova installation:

https://nova.laravel.com/docs/4.0/resources/validation.html#the-aftercreationvalidation-method

/**
 * Handle any post-creation validation processing.
 *
 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
 * @param  \Illuminate\Validation\Validator  $validator
 * @return void
 */
protected static function afterCreationValidation(NovaRequest $request, $validator)
{
    if ($this->somethingElseIsInvalid()) {
        $validator->errors()->add('field', 'Something is wrong with this field!<br/> somtheing else <br/>last but not least :)');
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions