Anvil Community Forum

alert/Form issue

What I’m trying to do:
format alert within a Form specifically move button above the Data Grid , if you click the “Add New”
button i want the save/cancel button above the data grid "If Possible’ maybe it can’t be done …

What I’ve tried and what’s not working:
various this to no avail

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
https://anvil.works/build#clone:UF6OZAA25DFRGGCB=NMJZU57CIABLDSYBQ4IBIWOX

First of all, you haven’t provided enough details to explain your case. Please try to be as detailed as possible next time.

Currently, the anvil’s built-in alert only supports buttons in the footer. But you can manually add your own buttons to the form(PTSched here). And if you want to close the alert when the button is clicked, just call self.raise_event('x-close-alert')

You can create your own form, place the buttons wherever you like, then use it in an alert without buttons, something like this:

f = MyForm()
alert(content=f, buttons=[])
print(f.textbox_1.text)

See here for details.

2 Likes

thank you @stefano.menci , exactly what i was after ,

1 Like

I’m glad it helps.

This InputBox uses the same technique to show custom content inside an alert. The difference is that, instead of using a manually designed form, it creates one from code starting with a LinearPanel and adding components to it.

2 Likes