Page 1 of 1

Disable Editing

Posted: Sun May 13, 2018 11:30 pm
by atom
How do you disable editing of
the whole form?

Re: Disable Editing

Posted: Mon May 14, 2018 12:18 am
by admin
atom,

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

Disable the Save Button when you set up Access Levels.

Steven

Re: Disable Editing

Posted: Mon May 14, 2018 8:27 am
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');

Re: Disable Editing

Posted: Mon May 14, 2018 9:04 am
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.

Re: Disable Editing

Posted: Mon May 14, 2018 10:11 am
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?

Re: Disable Editing

Posted: Tue May 15, 2018 1:49 am
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

Re: Disable Editing

Posted: Tue May 15, 2018 6:38 am
by toms
Thanks, the fix works for me.

Re: Disable Editing

Posted: Tue May 15, 2018 11:23 pm
by admin
.