Required validation in query builder

Hello,


How can we trigger *Required* validation in query builder, when user doesn't enters the value and click outside component or focus is changed to other element/component.

We don't have a validate button to trigger the validation.




1 Reply

YA YuvanShankar Arunagiri Syncfusion Team June 29, 2022 01:12 PM UTC

Hi Sanjay,


We have validated your reported query and prepared the sample based on your requirement. We can achieve your requirement by using the valueModel property of the querybuilder. Please refer the below code snippet and sample.


[app.component.ts]:

textModel: TextBoxModel = { blur: this.onFocusOut};

 valueModel = { textBoxModel: this.textModel };

 

    onFocusOut(): void {

        var qbObj = document.getElementsByClassName('e-query-builder')[0].ej2_instances[0];

        qbObj.validateFields();

    }


Sample link: https://stackblitz.com/edit/angular-z8mdcf?file=app.component.ts,app.component.html


Could you please check the above code and get back to us, if you need any further assistance on this. 


Regards,

YuvanShankar A


Loader.
Up arrow icon