cheesegrits
Support Gopher
Not sure what you mean by seeing an edit option for a table on a form. Are you talking about the related data feature?
-- hugh
-- hugh
We have now opened a commercial services section here on the forum for registered users. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.
Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.
For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
rob
- Edit your form's table.
- Select the "data" tab
- Under the "prefilter" section press "add filter"
- Select "username" from the field dropdown (the "username" element we previously created)
- Select "EQUALS" from the condition drop down list
- Enter "{$my->id}" (without the quotes) into the "value" field
- Select "super administrator" from the filter drop down. NOTE ! - this means that the filter is applied to everyone EXCEPT the super administrator. So in our case normal users will see only their records, where as the super administrator will see all the records
- Save your table
For the life of me I can't find where to change Row ID to -1 .... i'm on 1.5 / 2.x. Very strange...What version of Fabrik are you using? Some little bits of the following may be slightly different depending on the version, but you should be able to muddle thru regardless.
Add a User element as per Rob's original instructions. Lets call it 'userid'. Make it hidden, and set to NOT update on edit.
On your menu link (in the Joomla menu manager) you need to edit the parameters, and set the following.
Row ID: -1
Key name: userid
The row id of -1 is then treated differently by Fabrik, which replaces it with the userid of the currently logged on user.
Setting "key name" to userid forces Fabrik to then use that User element as the database key to match the userid against, rather than the primary key of the table.
Once this is done, the first time you hit that link, Fabrik should create a new table entry (row) for the form, and automatically fill in the userid field. From then on, when the same user hits that link, it should load the previously created row.
Oh, and make sure you set the Access Level on the menu link to Registered, otherwise things go hinky if guests hit it (as they all have a userid of 0).
-- hugh
How can I ensure users only see records created by themselves?
In your form add a "username" element, called "username" This element automatically inserts the current user's userid into your form as a hidden field.
Now each time you users adds a record, via the form, to the database table, their user id is also recorded.
The second thing to do is to edit your table, and add a prefilter so that each user sees only the records that they have created:
- Edit your form's table.
- Select the "data" tab
- Under the "prefilter" section press "add filter"
- Select "username" from the field dropdown (the "username" element we previously created)
- Select "EQUALS" from the condition drop down list
- Enter "{$my->id}" (without the quotes) into the "value" field
- Select "super administrator" from the filter drop down. NOTE ! - this means that the filter is applied to everyone EXCEPT the super administrator. So in our case normal users will see only their records, where as the super administrator will see all the records
- Save your table
the tip about username(raw)
http://fabrikar.com/forums/index.php?wiki/pre-filters/1. the "username" element must be of element type "user" (assuming username is your element name)
2. you can select what should be shown in table (list in fabrik3) or form (e.g. Name or Username), but the UserID is stored in the database
3. in the prefilter choose
username(raw) EQUALS {$my->id}
Fabrik3 lists are fabrik1/2 tables but the principle is all the same: add a prefilter (in fabrik3 to your list)
http://fabrikar.com/forums/index.php?wiki/pre-filters/