Hi, I need this:
User with special role is logged on the website and submit webform.
Admin need to add status to this submitted webform.
Only admin, not User, can edit this field. But User needs to view this field (status).
For now I used private field on webform, but User cannot view this data. "Access own webform results" permission is not working.
Comments
Hi 2x4b. Welcome to the Backdrop CMS forum.
If you are comfortable creating a small custom module (easy to do!), you can use a public field (not a private one), and implement
hook_webform_component_render_alter()
to hide the field that you don't want your user to fill in in the form, if the logged in user doesn't have a specific role. Then, your admin can edit the submission, and fill in that field. Since the field is public, the value WILL be shown to the user when he sees the results.For example, if your custom module is
testing_stuff.module
:In the example above, only roles
editor
andadministrator
will be able to see the field when filling in the webform.In my example above, the component ID for that field is
2
. You'll need to find out the exact component ID for the fiend you want to hide in the form. To do this, you can insertdebug($component);
within that function, and you'll see an array for each of the components of the webform. Then check thecid
for the one you want to hide.Thank you, it could be the way...
But now, I accidentaly made this private field public, but hide in private fieldset... not 100% sure, but it seems, I as admin can edit this Status field and User is not seeing this field on form submission. But User can see this Status value in view made with Views...
So maybe Public field in Private Fieldset is workaround, if result is presented to the User with special Views View with that all and this field.