How to add field validation rules in KANBAN dialog template

Hi,


for example, how to make the field Summary can not empty. Thanks




3 Replies 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team January 14, 2021 10:45 AM UTC

Hi Hugo, 

Greetings from Syncfusion Support. 

Currently we don’t have in-built field validation for Kanban fields, so we have prepared a sample using EditForm for your reference which can be downloaded from the following link. 

CardValidation = (TasksModel)context; 
                <EditForm Model="CardValidation" Context="FormCcontext" OnValidSubmit="OnSubmit"> 
                    <DataAnnotationsValidator /> 
                    <ValidationSummary /> 
                    <table> 
                        <tbody> 
                           
                            <tr> 
                                <td class="e-label">Summary</td> 
                                <td> 
                                    <SfTextBox @ref="SummaryRef" CssClass="e-field" Multiline="true" @bind-Value="@CardValidation.Summary"></SfTextBox> 
                                    <ValidationMessage For="@(() => CardValidation.Summary)" /> 
                                </td> 
                            </tr> 
                        </tbody> 
                    </table> 
                    <div class="custom-footer"> 
                        <SfButton CssClass="e-primary e-flat" Content="Save"></SfButton> 
                    </div> 
                </EditForm> 
 
<style> 
//to position the custom save button 
    .custom-footer { 
        text-align: right; 
        position: absolute; 
        width: 247px; 
        bottom: 15px; 
    } 
//to hide default save button  
    .e-dialog .e-footer-content .e-dialog-add {  
        display: none; 
    } 
</style> 
    public TasksModel CardValidation = new TasksModel(); 
    private void OnSubmit() 
    { 
        KanbanRef.AddCard(CardValidation); //to add the card 
        KanbanRef.CloseDialog(); //to hide the dialog 
    } 

Please try the above sample and let us know if you need any further assistance. 

Regards, 
Nevitha 


Marked as answer

HZ Hugo Zhao January 15, 2021 02:38 AM UTC

Thank you so much


NR Nevitha Ravi Syncfusion Team January 15, 2021 04:05 AM UTC

Hi Hugo, 

You are most welcome..! please get back to us if you need any further assistance. 

Regards, 
Nevitha 


Loader.
Up arrow icon