I'm working on a task where the user needs to be able to enter a space in the form field. I have attached an example of the setup code I am currently using. When the user attempts to add a space in the textbox it is simply not accepted and nothing happens. I have been researching this issue and have not found much help available. So my question are: Is there a workaround? Should I be taking a different approach?
public string CustomerName
{
get { get return Ship.CustomerName ?? ""; }
set { Ship.CustomerName = value; }
}
<FormItems>
<FormItem Field="@nameof(Example.CustomerName)"/>
</FormItem>
Update:
While troubleshooting this issue I learned a couple of things. My input fields were placed inside of the Telerik Panel Bar. This panel bar is preventing / not registering spaces. I looked through the documentation to see if this was intentional and have not found anything. Has anyone encountered any similar issues? If so, what did you use as a workaround?
Documentation: https://docs.telerik.com/blazor-ui/components/panelbar/events
<TelerikForm Model="@_Customer"
OnValidSubmit="@HandleValidSubmit"
OnInvalidSubmit="@HandleInvalidSubmit">
<FormItems>
<FormItem Field="@nameof(Customer.Name)"></FormItem>
<FormItem Field="@nameof(Customer.City)"></FormItem>
</FormItems>
</TelerikForm>
<code>
@Result
</code>
@code {
public Customer _Customer { get; set; } = new Customer();
public bool ValidSubmit { get; set; } = false;
public string Result { get; set; } = string.Empty;
async Task HandleValidSubmit()
{
ValidSubmit = true;
Result = $"{_Customer.Name} {_Customer.City} len{_Customer.Name.Length}";
await InvokeAsync(StateHasChanged);
}
void HandleInvalidSubmit()
{
ValidSubmit = false;
}
public class Customer
{
public string Name { get; set; }
public string City { get; set; }
}
}
Have a look at the attachment - is counting also spaces - sorry is not possible (only as an answer) Post the picture as an answer in a few seconds