Save Button on long forms.

DLJonsson

Well-known member
Is it possible to put save buttons throughout a long data entry form,
similar to the way you put mutiple [Save Configuration] buttons
in the databik form configurator.
 

eugenio

Administrator
Staff member
Hello,
no, at the moment it is not possible but it's an interesting improvement and probably quite easy to implement, I'll take not for the next version.

Best,
 

Stephan-H

Member
Here is a solution that clones the existing save buttons container html element on insert and edit forms and inserts clones of that element before each separator. (Works in DaDaBIK version 11.12-Elba enterprise.)

Precondition: In the Form configurator, use "Add Separator before this field (insert form)" and "Add Separator before this field (edit form)" to add separators to your long form (you may have already done this).

Then add the following code to your custom_functions.js:
JavaScript:
/* duplicates save_buttons_container and inserts a duplicate before each separator */
function duplicateAndInsertSaveButtons() {
    var $firstElement = $('.save_buttons_container:has(*)').first(); // Find the first element with the save_buttons_container class that has children (there are some that don't in the insert form)
    var $clonedElement = $firstElement.clone(); // Clone the found element
    $('.form_separator').each(function(index) { // Iterate over each separator element
        if (index > 0) { // Omit first element to avoid getting two save_buttons_container elements in direct succession on top of the edit form
            $clonedElement.clone().insertBefore($(this)); // Clone the original clone and insert it before the current target element
        }
    });
}
$(document).ready(function() {
    duplicateAndInsertSaveButtons();
});

Looks like this in the insert form (button colors have been customized):

Screenshot 2024-02-09 100935.jpg

Looks like this in the edit form (button colors have been customized):

Screenshot 2024-02-09 100802.jpg
 
Last edited:
Top