I have some ignite controls put in 2 tabs and I used popover to notify invalid data, I got problem with position of message showing when the tab changed
Is there a simple way to know if control invalid and I can prevent switch tab?
ps: I'm using ignite 15.2
Hello Quan,
Thank you for using our community.
I would like to ask for additional information in order to provide you a better support. Are you using jQuery UI tabs? What controls are you using in those tabs? Could you please send me a working sample, so I can assist you faster?
Best Regards, Marina Stoyanova, Software Developer, Infragistics, Inc.
Attched file is my sample
How to know invalidate controls in form?
https://postimg.org/image/ujtp9c7tv/
https://postimg.org/image/b38zmtcpv/
Thank you for providing me a sample. What you can do is create a loop on the swap switching event and check whether all of the editors are valid and if not then cancel the event like this:
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) { //switch tab
var tabKey = e.target.hash;
tabKey = tabKey.replace('#', '');
for (var i = 1; i < 21; i++) {
if (!$("#txt" + i).igTextEditor("validator").isValid()) {
e.preventDefault();
return false;
}
});
Another solution can be using a single validator on multiple fields. You can find more about that approach in our online documentation: http://www.igniteui.com/help/igvalidator-overview#setting-up
Attached you can find a modified version of your sample. If you need further assistance let me know.
Hello,
I'm glad to hear that you found a solution. If you need further assistance, let me know.
Regards,
Marina Stoyanova
Software Developer,
Infragistics, Inc.
Thank you for your suggestions and I found the event that help me shorter code
var isValid = true; $(document).delegate("#frmTest", "igvalidatorformerror", function (evt, ui) { isValid = false; });
isValid = true;
$("#frmTest").submit();
if (!isValid) {
$("#frmTest").submit(function (e) { e.preventDefault(); //prevent default form submit return false; });
The other approach is to use the validated event on every editor you have and attach it to a single handler that will check whether the input is valid or not.
var prevent = false;
function editorValidated(evt, ui) {
if (!ui.valid) {
prevent = true;
Then on switch of the tags you can check whether the flag has changed and if yes then cancel the switch event.
if (prevent) {
Please take a look at the provided link and If you have questions let me know.
Thanks for answer me,
But I mean is on a form that have many controls(over 100) with diffrence types such igTextEditor, igDatePicker, igCombo, igNumericEditor ... and the controlid not indexed. So, how can I loop through all controls and call isValid function (I used igEditors control for input valus)
Regards.