Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Disable Editing

Questions related to using nuBuilder Forte.
Post Reply
atom
Posts: 12
Joined: Mon Jan 22, 2018 9:08 am

Disable Editing

Unread post by atom »

How do you disable editing of
the whole form?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Disable Editing

Unread post by admin »

atom,

https://wiki.nubuilder.cloud/ ... cess#Forms

Disable the Save Button when you set up Access Levels.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Disable Editing

Unread post by toms »

admin wrote:atom,

https://wiki.nubuilder.cloud/ ... cess#Forms

Disable the Save Button when you set up Access Levels.

Steven
Smart users can still call nuSaveAction() to save the record.

Until this is fixed, you can add this PHP code in the BS event:

Code: Select all

nuDisplayError('Saving is disabled');
atom
Posts: 12
Joined: Mon Jan 22, 2018 9:08 am

Re: Disable Editing

Unread post by atom »

Exactly, when you have "workflow" logic in your
application this wont work,
- you have a status field, initially set to "Draft"
- another user access level, set status field to "POSTED"
in this case you normally add action button only visible
to this access level,
- in this action button is a logic plus a call to nSaveAction()
** and thats where the problem is, a user can change
fields value, even without the Save button, the
added Action button will still save the changes
made.

I have found the solution, to disable all inputs by
$('#nuRECORD :input').prop('disabled','true');

What is missing is to detect if the form has changed,
which is available on nuBuilderPro.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Disable Editing

Unread post by toms »

atom wrote: What is missing is to detect if the form has changed,
which is available on nuBuilderPro.
How did you detect that in nuBuilderPro?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Disable Editing

Unread post by admin »

atom,

I have disabled nuSaveAction() and nuDeleteAction() for cases where save and delete are not allowed.

The change is now on Github.

Let me know if it works for you.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Disable Editing

Unread post by toms »

Thanks, the fix works for me.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Disable Editing

Unread post by admin »

.
Post Reply