question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show Error Message in Textbox

See original GitHub issue

I have a Textbox that I just want user’s input is numeric, I use Validation Rule then I custom ErrorTemplate but I can’t show any message in Template. This is my Textbox: <TextBox Margin="100,20,100,0" x:Name="txbSDT" FontSize="14" FontFamily="/CoffeeHome;component/CoffeeHomeFont/#Roboto" materialDesign:HintAssist.Hint="Số điện thoại" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Validation.ErrorTemplate="{StaticResource textBoxErrorTemplate}"> <TextBox.Text> <Binding Path="Staff.Sdt" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <validation:NumericValidation PropertyName="Số điện thoại" ValidatesOnTargetUpdated="True"/> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox>

And this is my ErrorTemplate: <ControlTemplate x:Key="textBoxErrorTemplate"> <StackPanel> <Border BorderBrush="Red" BorderThickness="1"> <AdornedElementPlaceholder Name="a" /> </Border> <TextBlock Foreground="Red" Text="{Binding [0].ErrorContent}"/> </StackPanel> </ControlTemplate>

In the preview of Visual Studio I can still see the message but when I build and test the message doesn’t show. I can’t understand, is it because of the default of Material Design ? If someone can help me out, I will very grateful

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Keboocommented, Mar 21, 2018

@supernhok13 Excellent. I assume this issue can be closed now?

0reactions
MichelMichelscommented, Dec 24, 2021

Closed due to inactivity

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detect the error message in the input field - javascript
Firstly I would wrap the input in a form. After that you can use the setCustomValidity function for the input field to set...
Read more >
Show Error Messages In HTML Forms (Simple Examples)
This tutorial will walk through the common ways to show error messages in HTML forms. Free example code download included.
Read more >
How to display error message in html form with javascript
In this tutorial we are going to see how to display error message in html form with javascript.
Read more >
How to display error without alert box using JavaScript
We can show errors with two methods without using the alert box. Syntax: node. textContent = "Some error message" // To draw attention...
Read more >
Adding error messages to text input fields
Topic: Adding error messages to text input fields ... the class "form-control" to your input and it will display correctly just under the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found