requestFocus() endless loop

Hi All

I have seen this problem before, and I think I’ve even solved it before, but I can’t find the solution now.

I need to warn about existing values being overridden when a field is entered. When I enter the field using onFocusGained(), the warning appears, when I okay the dialog, it appears again and again (endless loop), even if I have requestFocus(false) on that correctly named element in my method. What am I doing wrong?

The field is a typeahead

This is my code:

function onFocusGained_warn_about_values() {
	
	
	if (foundset.estimate_total_retai > 0 || foundset.line_total > 0 || foundset.markup)
		{
		plugins.dialogs.showWarningDialog('Existing markups', 'There are already values in your retail fields or markup. Changing this code will change the markups\nand the retail values.','OK');
		elements.category.requestFocus(false)

		}
	}

if you can reproduce this in a sample please make a case.