I have an application that is using the Blazor DataGrid component along with the AutoComplete component and whenever a user enters non-alphanumeric characters and submits the form using either the Update button or the Enter key a JSON parsing error is thrown in the console.
We are using the Validator component elsewhere, so the default SyncFusion validation is not being used so I tried creating a custom validator but was not able to get that to work either. Besides that, my colleagues and I have tried various things with no luck. Please see screenshots and attached files, I'd appreciate any assistance you could provide.
Attachment: DataGrid_JSON__Parsing_Error_11222_38c9e956.zip
|
<EditTemplate>
@{
ServiceAssignment serviceAssignment = (context as ServiceAssignment);
. . .
}
<SfAutoComplete PopupWidth="320px"
Placeholder="---"
@ref="UicDropDownlistRef"
TItem="Uic"
TValue="Uic"
MinLength="3"
Value="serviceAssignment.Uic"
OnInput="UicCodeChangeHandler"
DataSource="uics"
ValueChanged="uic=>serviceAssignment.Uic = uic ?? serviceAssignment.Uic"
AllowFiltering="true">
. . .
</AutoCompleteTemplates>
<AutoCompleteEvents TItem="Uic" TValue="Uic" CustomValueSpecifier="@customValue" OnOpen="StateHasChanged" ValueChange=StateHasChanged Filtering="OnUicFilter" />
<AutoCompleteFieldSettings Text="Title" Value="Code" />
</SfAutoComplete>
</EditTemplate>
@code{
. . .
private void customValue(CustomValueSpecifierEventArgs<Uic> args)
{
args.Item = new Uic() { Code = args.Text, Title = args.Text };
}
. . .
}
|
When applying your solution, I am able to use the Enter key. My issue now is if a user enters a non-alphanumeric character such as ], I still get the error. I have tried using the custom validator with a Reguar Expression to handle these characters but I cannot get it working.