User Form Edit and View

Discussion in 'Community' started by cheyennemtnman, Nov 23, 2017.

  1. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    How would one have an user complete a form and then view it to edit or add to it at a later date and then allow only another specific user to view that completed/edited form after it has been completed/edited?

    I get this part... http://fabrikar.com/forums/index.php?wiki/users-editing-own-records/

    But how would I get a specific user assigned to view it?
     
    Last edited: Nov 23, 2017
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    An "unexpected end of file" usually means a file got truncated during an update, or you have some custom code with a syntax error (maybe in a calc).

    -- hugh
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    If you make sure your My Sites is up to date, and put in the notes anything I need to know (which form, front end menu for it, etc), I'll take a look when I get some time.

    -- hugh
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Just letting you know I haven't forgotten, but I'm moving house this week, it'll be next week before I can get to this.

    Sent from my HTC6545LVW using Tapatalk
     
  5. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Good luck on the move!
     
  6. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Back to my original question... How would one have an user complete a form and then view it to edit or add to it at a later date and then allow only another specific user to view that completed/edited form after it has been completed/edited?

    I know how to show in list with pre-filter using this
    where:
    field = your-user-element(raw)
    condition: equals
    value: {$my->id}
    type=text
    But How do I allow a user to view another specific user's record ... another table has a specific user id that stores which user is allowed to view the original users record that they had created.
     
    Last edited: Dec 1, 2017
  7. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    You'd have to create a subquery in the prefilter. So assuming you have a table called "formusers", which has two fields, 'owner' and 'editor'. And you original list has two fields 'owner' and 'completed' ... and once 'completed' is set, you only want to allow the 'editor' from the other table to edit ... but if 'completed' is not set, the 'owner' can edit ... you'd need four pre-filters ...

    field: completed
    condition: equals
    value: 0
    type: text

    field: owner(raw)
    condition: equals
    value: {$my->id}
    type: text
    join: and
    group[ to previous: yes

    field: completed
    condition: equals
    value: 0
    type: text
    join: or
    grouped to previous: no

    field: id
    condition: IN
    value: SELECT id FROM maintable LEFT JOIN formusers ON formusers.owner = maintable.owner WHERE formusers.editor = '{$my->id}'
    type: query
    join: AND
    groups to previous: yes

    -- hugh
     
    cheyennemtnman likes this.
  8. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Display_Details_tab.png Detail_Display_Option_tab.png
    Thanks Hugh... I will use that in a later version...
    but where do you place this pre-filter for a Detail Display in the Fabrik Menu Item?
    I created a field that has the user id for the table record( in the same table now) that I want to display the record for the assigned viewer.

    Do I do this in a php snippet in the plugin processing before loading ?
    I just want to display... so should I just create another form list to the same table but no updating buttons? I have a user id field in the same table that points to a record that that user can view but not edit.
     
    Last edited: Dec 1, 2017
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Sorry, I'm completely confused. You talked about having another table with the user id of the editor in it. And I didn't know you were talking about a menu link.

    For menu link, if you just have a simple field on the same table with a userid in it, and that field is unique (so there's only one row in the table with that userid), you can set rowid=-1 and put the field name in "Key name", like "editor" (short name of the element).

    -- hugh
     
    cheyennemtnman likes this.
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    BTW, when I offered to look at your site I thought you had a Pro sub for some reason, but looking at the records it looks like you haven't had a sub since 2013.

    -- hugh
     
  11. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    I did at one time... thanks for the offer...
     
  12. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    I tried that... but it came up as the logged in user record... So I guess I had the name wrong or something...
    UserID unique for each user... and the field I want to use is a field with the user id of the record to be viewed... does that make sense...
     
  13. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    I did get the name wrong... it is displaying a record but not the record I expected... seems to be one off...

    User 640 needs view User 641

    but it shows User 639 record instead
     
    Last edited: Dec 2, 2017
  14. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Oh well.

    -- hugh
     
    cheyennemtnman likes this.
  15. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Thanks for your help! I appreciate it! Good luck on the Move...
     
  16. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    After some testing ... With about 10 records... I could not achieve the row id / keyname for displaying a detail record with a field that had the id of the row I wanted to display to the viewer. It seems that it finds a record but not the one assigned. Each time it does find the same record which is incorrect.

    User ID which= {$my->id} | Assigned to be Viewed ID (Expected) | Displays USER ID


    640 | 643 | 647
    642 | 644 | 648
    643 | 648 | 640
    644 | 646 | 642
    645 | 647 | 649
    646 | 649 | 644
    647 | 640 | 645
    648 | 642 | 643
    649 | 645 | 646
     
    Last edited: Dec 2, 2017
  17. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Anyone have a work around since it seems the -1 / keyname does not seem to work

    no value in the viewer id field results in displaying the user's own record

    Would be nice to have a pre-filter tool available for displaying a form record using detail display from the menu link
     
    Last edited: Dec 2, 2017
  18. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    For menu link, if you just have a simple field on the same table with a userid in it, and that field is unique (so there's only one row in the table with that userid), you can set rowid=-1 and put the field name in "Key name", like "editor" (short name of the element).

    Okay I think I have sorted out what is happening with the attempt on displaying a record of an user created record for an assigned user to view.

    If you look at the above table you will see a listing of user records in a table. Each record has an unique ID (640, 642, 643 etc.) The next column is the assigned viewer of the record. (643, 644, 648, etc.) Each viewer id is unique for each User created record. Both fields reside in the same table.

    What is happening when setting the rowid to -1 and the Keyword to the Viewer ID element name is that it is populating the display with the assigned viewer's "assigned viewer's" data and not the assigned user's data. (i.e. 640 should display 643 data and not the data for 647 which is the assigned viewer of user ID 640.

    How does that work?

    Can I get a menu item display of the User's data by the assigned Viewer when the viewer is logged in? If so how? If not... work around thoughts?
     
    Last edited: Dec 6, 2017 at 4:40 PM
  19. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Yes , no ... work around?
     
  20. cheyennemtnman

    cheyennemtnman Member

    Level: Community

Share This Page