Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation for RichTextBox #1792

Open
ivancavlek opened this issue Feb 4, 2021 · 2 comments
Open

Validation for RichTextBox #1792

ivancavlek opened this issue Feb 4, 2021 · 2 comments
Labels
Type: Feature ⚙ Request or idea for a new feature.
Milestone

Comments

@ivancavlek
Copy link

Hi!

Is it possible to validate RichTextBoxes and how?
If not, will this feature be added?

Regards,
Ivan

@stsrki
Copy link
Collaborator

stsrki commented Feb 4, 2021

Not at the moment but it could be added sometime in the future.

@stsrki stsrki added this to the 1.2 milestone Apr 3, 2022
@stsrki stsrki added the Type: Feature ⚙ Request or idea for a new feature. label Nov 22, 2022
@stsrki stsrki added this to 🔙 Backlog in Development via automation Nov 22, 2022
@stsrki
Copy link
Collaborator

stsrki commented Jan 3, 2023

The built-in validation would require significant API changes to the RTE. We will move this feature to v2.0.

Until then, as a workaround the validation can be done as follows:

<RichTextEdit @ref="richTextEditRef"
                ConfigureQuillJsMethod="blazoriseDemo.configureQuillJs"
                ContentChanged="@OnContentChanged"
                Border="@( string.IsNullOrWhiteSpace( contentAsText ) ? Border.Danger : null)">
      ...
  </RichTextEdit>
  @if ( string.IsNullOrWhiteSpace( contentAsText ) )
  {
      <Paragraph TextColor="TextColor.Danger">Text is empty</Paragraph>
  }
  else
  {
      <Paragraph TextColor="TextColor.Success">Text is valid</Paragraph>
  }
@code{
    private string contentAsText;

    public async Task OnContentChanged()
    {
        contentAsText = await richTextEditRef.GetTextAsync();
    }
}

@stsrki stsrki removed this from 🔙 Backlog in Development Jan 3, 2023
@stsrki stsrki modified the milestones: 1.2, 2.0 Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature ⚙ Request or idea for a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants