Skip to content

Commit 1998c9f

Browse files
committed
working on tutorial for configuring clients accounts to only edit own data
1 parent 3b799a7 commit 1998c9f

14 files changed

+397
-152
lines changed

_config_local.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ---------------------------------------------------------------------
1+
f# ---------------------------------------------------------------------
22
# Used when loading the docs within the context of the website. LOCAL.
33
# ---------------------------------------------------------------------
44

_data/screenshots.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@
1010
caption: "Edit Form - Emails tab"
1111
main_link: ""
1212
list_order: 0
13-
-
14-
screenshot_id: 19
15-
component_type: "core"
16-
component_id: 0
17-
thumb_filename: "i19_th.jpg"
18-
filename: "i19.jpg"
19-
caption: "Edit Form - Fields tab"
20-
main_link: ""
21-
list_order: 0
2213
-
2314
screenshot_id: 20
2415
component_type: "core"
@@ -3259,7 +3250,6 @@
32593250
caption: "Multiple file upload"
32603251
main_link: ""
32613252
list_order: 0
3262-
32633253
-
32643254
screenshot_id: 388
32653255
component_type: "module"
@@ -3269,4 +3259,23 @@
32693259
caption: "Customize uploaded filename format"
32703260
main_link: ""
32713261
list_order: 0
3262+
-
3263+
screenshot_id: 389
3264+
component_type: "core"
3265+
component_id: 16
3266+
thumb_filename: "edit-form__fields_tab_th.png"
3267+
filename: "edit-form__fields_tab.png"
3268+
caption: "Edit Form » Fields tab"
3269+
main_link: ""
3270+
list_order: 0
3271+
-
3272+
screenshot_id: 389
3273+
component_type: "core"
3274+
component_id: 16
3275+
thumb_filename: "tutorial-client-map-edit-view-general-tab_th.png"
3276+
filename: "tutorial-client-map-edit-view-general-tab.png"
3277+
caption: "Edit View -> General tab"
3278+
main_link: ""
3279+
list_order: 0
3280+
32723281

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div {% if include.selected == 'introduction' %}class="selected"{% endif %}>
2+
<a href="{{site.baseurl}}/tutorials/client_accounts_edit_own_data_only/">Introduction</a>
3+
</div>
4+
5+
<ol>
6+
<li {% if include.selected == 'hidden_mapping_field' %}class="selected"{% endif %}>
7+
<a href="{{site.baseurl}}/tutorials/client_accounts_edit_own_data_only/hidden_mapping_field/">Add hidden mapping field</a>
8+
</li>
9+
<li {% if include.selected == 'configure_form_view' %}class="selected"{% endif %}>
10+
<a href="{{site.baseurl}}/tutorials/client_accounts_edit_own_data_only/configure_form_view/">Configure form view</a>
11+
</li>
12+
<li {% if include.selected == 'all_submissions_view' %}class="selected"{% endif %}>
13+
<a href="{{site.baseurl}}/tutorials/client_accounts_edit_own_data_only/all_submissions_view/">Create view showing all submissions</a>
14+
</li>
15+
</ol>
260 KB
Loading
31.4 KB
Loading

assets/screenshots/i19.jpg

-208 KB
Binary file not shown.

assets/screenshots/i19_th.jpg

-22.2 KB
Binary file not shown.
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
layout: default
3+
navPage: docs
4+
heading: Configuring client accounts to only edit their own form data
5+
breadcrumbs:
6+
- Tutorials,/tutorials
7+
- Configuring client accounts to only edit their own form data
8+
prev: Configure form view,/tutorials/client_accounts_edit_own_data_only/configure_form_view/
9+
next: Create view showing all submissions,/tutorials/client_accounts_edit_own_data_only/all_submissions_view/
10+
categories: tutorial
11+
tags: permissions,accounts,views
12+
---
13+
14+
{% include open_section.html nav='nav_client_accounts_edit_own_data_only.html' selected='all_submissions_view' nav_width=3 %}
15+
16+
{% include close_section.html %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
layout: default
3+
navPage: docs
4+
heading: Configuring client accounts to only edit their own form data
5+
breadcrumbs:
6+
- Tutorials,/tutorials
7+
- Configuring client accounts to only edit their own form data
8+
prev: Add hidden mapping field,/tutorials/client_accounts_edit_own_data_only/hidden_mapping_field/
9+
next: Create view showing all submissions,/tutorials/client_accounts_edit_own_data_only/all_submissions_view/
10+
categories: tutorial
11+
tags: permissions,accounts,views
12+
---
13+
14+
{% include open_section.html nav='nav_client_accounts_edit_own_data_only.html' selected='configure_form_view' nav_width=3 %}
15+
16+
<p>
17+
The next step is to configure a View:
18+
</p>
19+
20+
<ol>
21+
<li>Automatically store what Form Tools account created the submission.</li>
22+
<li>Set the view to <i>only show submissions for the current client account.</i></li>
23+
</ol>
24+
25+
<h3>Which View?</h3>
26+
27+
<p>
28+
You can read more about <a href="{{site.baseurl}}/userdoc/views/">Views here</a>, but the important things to know
29+
are: you can create as many Views as you want; each View can be configured differently to show different form data;
30+
by default, every new Form gets a new View created along with it called "All submissions".
31+
</p>
32+
33+
<p>
34+
For this tutorial, you can edit any View you'd like - so perhaps just make these changes default All Submissions
35+
view. You can rename it or add more Views later once you get a better feel for it.
36+
</p>
37+
38+
<h3>Editing the View</h3>
39+
40+
<h4>Tracking show created the submission</h4>
41+
42+
<p>
43+
Now click on the Views tab within the Edit Form pages. There, edit one of the Views (we'll pick the default
44+
"All Submissions" View, as shown in the screenshots).
45+
</p>
46+
47+
{% include screenshot.html item="tutorial-client-map-edit-view-general-tab.png" %}
48+
49+
<ul>
50+
<li>
51+
On the General tab, set the <b>Access</b> field to public. This will allow all clients that have access to the form
52+
also have access to this particular View.
53+
</li>
54+
<li>
55+
Set the <b>Can add submissions</b> to <i>yes</i>.
56+
</li>
57+
<li>
58+
In the <b>Default Values for New Submissions</b> setting, add the field as shown in the screenshot to the right,
59+
namely: Field <i>Account ID</i> (the field you just created in the previous step) and default value:
60+
<i>{% raw %}{$ACCOUNT_ID}{% endraw %}</i>
61+
62+
<div class="alert alert-info">
63+
<b>{% raw %}{$ACCOUNT_ID}{% endraw %}</b> is a <i>placeholder</i>. It gets replaced with the user's account ID
64+
when the submission is created. For a full list of placeholders, see the section on the
65+
<a href="{{site.baseurl}}/userdoc/views/main_tab/">Default Values for New Submissions</a> field.
66+
</div>
67+
</li>
68+
<li>
69+
Click save.
70+
</li>
71+
</ul>
72+
73+
<p>
74+
What you've just done is configure your View to store the account ID of whatever user just created the form
75+
through the Form Tools interface. As mentioned before, submissions created from an external, API or Form Builder
76+
form won't have this value populated: it's only for submissions created within Form Tools.
77+
</p>
78+
79+
80+
<h4>Making the View only show submissions for the current user</h4>
81+
82+
83+
84+
{% include close_section.html %}
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: default
3+
navPage: docs
4+
heading: Configuring client accounts to only edit their own form data
5+
breadcrumbs:
6+
- Tutorials,/tutorials
7+
- Configuring client accounts to only edit their own form data
8+
prev: Introduction,/tutorials/client_accounts_edit_own_data_only/
9+
next: Configure form view,/tutorials/client_accounts_edit_own_data_only/configure_form_view/
10+
categories: tutorial
11+
tags: permissions,accounts,views
12+
---
13+
14+
{% include open_section.html nav='nav_client_accounts_edit_own_data_only.html' selected='hidden_mapping_field' nav_width=3 %}
15+
16+
<p>
17+
{% include screenshot.html item="edit-form__fields_tab.png" %}
18+
The first step is to create a new form field to track who created the form submission. Adding new fields on this
19+
page does <b>not</b> mean they become visible for users within Form Tools. They only appear in the interface when
20+
they are explicitly added to your form View(s). In our case we're just going to be using this field programmatically,
21+
so adding it to this page is enough.
22+
</p>
23+
24+
<ul>
25+
<li>Log in as the administrator and edit your form.</li>
26+
<li>On the Edit Form &raquo; Fields tab (shown in the screenshot to the right) add a new field with the following
27+
values:
28+
29+
<ul>
30+
<li><b>Display Text</b>: Account ID</li>
31+
<li><b>Form Field</b>: ft_account_id</li>
32+
<li><b>Field Type</b>: Textbox</li>
33+
<li><b>Pass On</b>: [unchecked]</li>
34+
<li><b>Field Size</b>: Small</li>
35+
<li><b>Sort As</b>: String</li>
36+
<li><b>DB Column</b>: ft_account_id</li>
37+
</ul>
38+
</li>
39+
</ul>
40+
41+
<p>
42+
At this point you've now added a field to store who created the submission.
43+
<a href="{{site.baseurl}}/tutorials/client_accounts_edit_own_data_only/configure_form_view/">Onto the next step!</a>
44+
</p>
45+
46+
{% include close_section.html %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
layout: default
3+
navPage: docs
4+
heading: Configuring client accounts to only edit their own form data
5+
breadcrumbs:
6+
- Tutorials,/tutorials
7+
- Configuring client accounts to only edit their own form data
8+
next: Add hidden mapping field,/tutorials/client_accounts_edit_own_data_only/hidden_mapping_field/
9+
categories: tutorial
10+
tags: permissions,accounts,views
11+
---
12+
13+
{% include open_section.html nav='nav_client_accounts_edit_own_data_only.html' selected='introduction' nav_width=3 %}
14+
15+
<p class="alert alert-warning">
16+
This tutorial requires <b>Form Tools 3.0.13</b> or later.
17+
</p>
18+
19+
<p>
20+
This tutorial explains how you can configure a Form Tools form so client can <i>only edit their own
21+
form data</i> and nobody else's. You can optionally configure it so client accounts can <i>view</i> other data
22+
in the form, but only readonly. This technique works for any form, regardless of form data.
23+
</p>
24+
25+
<p>
26+
This tutorial is conceptually quite complicated and covers a fair bit of ground. So if you have any questions,
27+
do pipe up with a <a href="https://github.com/formtools/core/issues" target="_blank">question</a>. But once you
28+
see how it works, you'll have a decent understanding of how Form Tools Views work.
29+
</p>
30+
31+
<p>
32+
In abstract, here's how it'll work.
33+
</p>
34+
35+
<ol>
36+
<li>We're going to add a database field to your form that tracks <b>which Form Tools account created the submission</b>.</li>
37+
<li>We'll configure a form View to limit results to only show results created for the current client account.</li>
38+
<li>(Optional) create a second readonly View so client accounts can view all data in the form, but not edit it.</li>
39+
</ol>
40+
41+
<h3>Restrictions</h3>
42+
43+
<ul>
44+
<li>
45+
This technique only applies to submissions created within the Form Tools interface (Internal forms), not
46+
<a href="{{site.baseurl}}/modules/form_builder/">Form Builder forms</a> or
47+
<a href="{{site.baseurl}}/userdoc/form_management/adding_external_forms/">External forms</a>.
48+
</li>
49+
<li>
50+
This tutorial explains how to set it up for a <i>single</i> form. If you need clients to only edit their own data
51+
for multiple forms, you will need to make the same change to each form.
52+
</li>
53+
</ul>
54+
55+
{% include close_section.html %}

0 commit comments

Comments
 (0)