Anvil Community Forum

Can't set focus on button

A button does not seem to have the focus() method (well, not in the autocompleter anyway).

6 Likes

+1

This would be particularly useful for data entry forms and workflows

2 Likes

I think AnvilAugment is supposed to make this possible, but I don’t see a description of how to do it in the augment docs. If anyone has succeeded in doing this, could you spell it out for me?

Thanks!

self.button_1.trigger("focus") should do it.

4 Likes

That works, thanks! (Only need to correct the oddball quotation mark near the end.) I didn’t think it could be that simple.