Add a record but not edit it once it's been added.

stevenpryer

Steven Pryer
I'd like registered users to be able to create a single new record, but then not be able to edit it once it's been created.

I've created a test site using the following steps:
  1. Create a new empty list with default settings.
  2. Create the following elements with default settings:
    1. 'User' element called user_id
    2. 'Field' element called create_but_no_edits
  3. Adjust Access property for the create_but_no_edits element, so that Form (edit) = Super users.
  4. Create a new Menu item for this newly created Fabrik form (Access = Registered).
  5. Fabrik Form options: Row id = -1, Key name = user_id
I then login, in the hope that I could create a new record, and then view it afterwards, without being able to make subsequent edits.
Interestingly the user_id element can be edited (I would normally hide this).
The create_but_no_edits element has a visible label, but no input box.

To be clear, I'm hoping to be able to make an input here, because I'm a registered user with the Add access, but not be able to edit, because I'm not logged on as a Super user.

Interestingly I had this same issue 2 years ago, and I was delighted when Cheesegrits very kindly provided a fix in GitHub. However unfortunately this issue has reappeared for me.

Many thanks for any help in this matter, I can provide login details to my test site if needed.
 
Last edited:
Have you tried just setting the list access controls for Add (Public) and Edit (Special, or whatever)?



Sent from my HTC6545LVW using Tapatalk
 
Hello Cheesegrits!

Lovely to hear from you :)

Yes, I have tried this (should've added in the notes). In that scenario, when I try to save the record as the Registered user, I get the message saying:
  • Sorry, but you are not authorised to edit this record
... and of course the record doesn't get saved.
 
Hmm. OK, I'm looking at that now. I think I know why that might be happening (it's the "rowid = -1" thing, Fabrik is seeing a rowid and thinking the row exists).

-- hugh
 
OK, I have a fix for it locally, but I want to run with it for a day or so before I commit, make sure it doesn't break anything else.

It was indeed an issue with the 'usekey / rowid=-1' thing, where we check the add/edit ACL's. With rowid=-1, the rowid has a value, even on a new form. Our test for isNewRecord() during submission ACL checks just tested to see if rowid had a value, so incorrectly though it was editing a record. And even if it checked to see if the usekey method was being used, wasn't able to tell whether it really was a new record or not. I had to add a hidden variable when rendering the form itself, and check that on a form submit.

-- hugh
 
Hi Hugh,
Many thanks for your help in this matter, it is much appreciated!
I look forward to hearing from you when you have more news :)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top