Is there any way to hide the Save, Delete, etc.. buttons in dbFront?

0 votes

By default dbFront creates four buttons:

  • Save Changes
  • Delete Entry
  • Create New
  • Create Copy

How can you hide those buttons?

in Customization by (7.0k points)

1 Answer

0 votes
Best answer

The visibility of those buttons is actually determined by the table & row security.

Control Visibility using Row Security

For more details see: Table Security​​

  • If the connection has no select access, the table will be hidden.
  • If the connection has no delete access, the delete button will be removed.
  • If the connection has no insert access, the "Create New", "Create Copy" buttons will be removed.
  • If the connection has no update access, the "Save" button will be removed.

Another option is to add an expression in the "Row Security" tab such as "0=1​" for the functionality that you want to disable.

For more details on the row security see: Row Security

Control Visibility with CSS

One additional option is to use CSS to hide specific buttons. This is not a secure solution but it can be appropriate if for example you want to remove the 'Create Copy' button while leaving the 'Create New' button visible.

To hide the 'Create Copy' button in all areas of dbFront, you would add the custom CSS to a custom CSS file.

button[action=rowInsertCopy] { display: none; }

If you only want to affect a specific table then you can add a CSS class to the table in the layout tab. If we were to set the tables CSS class to productTable then you would update the custom CSS as follows:

.productTable button[action=rowInsertCopy] { display: none; }

Or you could simply create a CSS class name like hideCopyButton and add it to all tables where you want the copy button hidden. You can add multiple CSS class names to a table or any other element. The custom CSS would look as follows.

.hideCopyButton button[action=rowInsertCopy] { display: none; }

For directions on where to add your custom CSS see: Custom CSS Files

by (64.3k points)
edited by
Is there any way to keep "Create New" but hide "Create Copy"?
I updated this answer with directions for using CSS to hide the 'Create Copy" button.
What would the CSS be to hide the Save Changes button on a specific table (i.e. not all areas of dbFront), if possible?
Hello Daniel, I updated the answer with two examples showing how you can make the changes for specific tables only.
Welcome to the dbFront Q&A site, where you can ask questions and receive answers from other members of the community.
 | Minimalist Answer Theme by Digitizor Media
Powered by Question2Answer