Saving permanently sets the save button to disabled.

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-20 06:43

When I save a record in the detail view, the save button is disabled, and further changes can no longer be saved.

saymaad
AppGini Super Hero
AppGini Super Hero
Posts: 56
Joined: 2024-06-03 16:17

Re: Saving permanently sets the save button to disabled.

Post by saymaad » 2025-01-20 09:07

Are your changes saved the first time?

Last year there was an update which disables the save buttons as a safety precaution, you have to click the unlock button to enable saving and avoid unintentional changes. Is that mechanism not working properly?

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-20 21:29

Hi,

yes, I can save once, only then does the button go into secured mode. Latest appgini version. That doesn’t make much sense to me. Either the button is immediately disabled, or I lock the button myself.

saymaad
AppGini Super Hero
AppGini Super Hero
Posts: 56
Joined: 2024-06-03 16:17

Re: Saving permanently sets the save button to disabled.

Post by saymaad » 2025-01-22 03:46

I understand that sometimes changes in the application may not make sense to every user. For example, I’m used to clicking the table title in the Detail View to return to the Table View, but this feature was removed in recent versions as people thought it was a bug. In the future, I may either have to adjust to the new behavior or modify the source files to bring it back, but for now, I’m sticking with the older version of AppGini, at least till Bootstrap 5 and field level security feature is implemented or there are major security issues or fixes.

Similarly, if you are willing to change the core files generated by AppGini, for removing the lock button and restoring old functionality, it’s possible. However, this isn’t the recommended approach, since you would need to make these changes again every time you regenerate the project.

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-22 05:40

Thank you. I think most users won't notice because they save only once. :-)

saymaad
AppGini Super Hero
AppGini Super Hero
Posts: 56
Joined: 2024-06-03 16:17

Re: Saving permanently sets the save button to disabled.

Post by saymaad » 2025-01-22 05:53

Welcome, by the way if you don't mind having a line of javascript in tablename-dv.php or as part of hook / php you use the following to ensure that the save button is always enabled ;) :

$j('#update').prop('disabled', false);

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-22 23:19

Thank you very much.

I tried this and put that code in my tablename-dv.js.

But it will not work.

saymaad
AppGini Super Hero
AppGini Super Hero
Posts: 56
Joined: 2024-06-03 16:17

Re: Saving permanently sets the save button to disabled.

Post by saymaad » 2025-01-23 08:10

Is it under $j(function() { } ? This works when the page is fully loaded, it is working on my project though.

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-23 11:20

Hi, yes. Butt it will not work:

$j(function() {
$j('#update').removeAttr('disabled');
});

Same, same

Do you have the latest AG Version?

saymaad
AppGini Super Hero
AppGini Super Hero
Posts: 56
Joined: 2024-06-03 16:17

Re: Saving permanently sets the save button to disabled.

Post by saymaad » 2025-01-23 12:11

Not the latest AG, I am using 24.10.1578 and it is working correctly on this version, haven't upgraded since. I can try with the latest trial version i.e. 24.19 and let you know what's the result, but that might take time. In the meantime, can you check the following:

1) Instead of removeAttr try: $j('#update').attr('disabled', false);, this also works for my version.

2) After saving, once the save button is disabled, open Developer Tools (F12 on Chrome & Edge) run the code on the console and see if it works. If this works, then we can further troubleshoot what is causing the button to be disabled. If it doesn't we can look into the error on the console.

3) If the above doesn't work, right-click on the save button and select the option to Inspect the element. The HTML should be same as the following:

Code: Select all

<button type="submit" class="btn btn-success btn-lg locking-enabled user-locked" id="update" name="update_x" value="1" onclick="return uom_validateData();" title="Save Changes" disabled="" style="width: 75%; overflow: hidden;"><i class="glyphicon glyphicon-ok"></i> Save Changes</button>
Let me know if the code is different than the above or the console throws an error. I doubt the id would have changed in the newer versions of AppGini, as even on the Northwind demo which was built with 24.18 has the same id.

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-23 17:16

I had to clear my browser cache.

$j('#update').attr('disabled', false); will work :-)

Thank you very much!!!

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Saving permanently sets the save button to disabled.

Post by SkayyHH » 2025-01-23 17:32

With this code in header-extras.php it works for all detail views.

Code: Select all

<script>
    document.addEventListener('DOMContentLoaded', function () {
        const observer = new MutationObserver(function (mutations) {
            mutations.forEach(function (mutation) {
                const button = document.querySelector('#update');
                if (button && button.disabled) {
                    button.disabled = false;
                }
            });
        });
        observer.observe(document.body, { childList: true, subtree: true, attributes: true });
    });
</script>
Thanks to chatgpt :-)

Post Reply