Combining a form and a dialog with buttons - how to manage focus

Skip to first unread message

Philipp Middendorf

Jul 24, 2022, 11:14:39 AM7/24/22
to Brick Users

I'm trying to combine a form with a few fields with a dialog in order to have a "insert new item" -> dialog layer popus up -> "fill out form" -> "press ok to confirm" workflow. So essentially, I'd just have buttons "Ok" and "Cancel", but still I don't really see how to do it.

My event handler already has an if/else for "is the dialog open". I would like the user to be able to cycle through the input fields from the form, and then through the buttons. But how do I combine the focus ring of the form (which is created by Brick.Forms) with the buttons (which I create externally)?


Jonathan Daugherty

Jul 24, 2022, 11:24:48 AM7/24/22
to Philipp Middendorf, Brick Users
Hello Philipp,

There is perhaps a way to get what you want, but it cannot be done
solely within the single form that you have now since the Form is
designed to handle common/simpler use cases.

Since you have control over when events are dispatched to the form, you
could intercept a relevant event (combined with checking the form state)
to decide when to pop up a dialog on top of the form. This would make
it possible to implement a modal dialog box (even with its own form for
data entry, as you described). Once you are satisfied with the data
entry in the dialog box, it would be closed and you'd be able to take
the resulting data and rebuild your form with the new data inserted.

The devil is in the details, naturally, and if you'd like to discuss
this further then I'd recommend opening a ticket where we can hash out
the details, see code samples, etc.

I hope that helps!
Jonathan Daugherty
Reply all
Reply to author
0 new messages