Posted by Ed Johnson on 08 Mar 2010 19:17, last edited by Ed Johnson on 30 Mar 2010 23:43
Tags:
Special thanks to James Kanjo and
leiger for their help in sorting this out.
Protecting/Hiding Form Data
Since data forms are based on a template page, you can design your form template page just like other live templates. You can include a "static" portion in your template that is used to display the form data when the page is viewed. By default, forms override any formatting when creating or editing the page (only the form itself is displayed), so the static formatting is only applied when the page is viewed.
This can be very useful if you need to collect information that you may not want to have publicly visible, but you still want to collect for administrative reasons, mailing lists, etc. In the example below, the form collects email and postal addresses, but they will not be visible on the page once it is saved. Only users with editing privileges will be able to see all of the form fields and their data.
Specifically, you would set permissions for the category your form pages are in as follows:
- edit = page owner/creator only
- show page options to = page owner/creator only
An alternative to the show page options to setting would be to modify your CSS to hide the History and Page Source buttons while still limiting the edit option to page creator/owner..
#history-button, #view-source-button { display: none; }
Example of a form _template page that will hide parts of the form's data
[!-- use this area to format the display of the data when viewing this page --]
++ %%form_data{member-name}%%
This page holds the information for %%form_data{member-name}%%.
For security reasons, personal information is only available to those with
editing rights to this page (%%form_data{member-name}%% and the administrators of this site).
Is %%form_data{member-name}%% signed up to receive the newsletter? **%%form_data{get-newsletter}%%**
====
[!-- design the layout of the form in this section --]
[[form]]
fields:
member-name:
label: Member name
email:
label: Email address
get-newsletter:
label: Get newsletter?
values:
0: No
1: Yes
default: 1
address-line-1:
label: Address
width: 30
address-line-2:
width: 30
address-line-3:
width: 30
[[/form]]
There's a problem with the syntax you have used. Look at the bottom of the page to see what I mean.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, made for Wikidot users (available early 2023)
I just noticed this earlier today too, but didn't have time to dig. There's something broken including the page from one of my sites. I'm just going to copy the code from the working page and paste it here, bypassing the include.
-Ed
Community Admin
Aargh! There's something with the live template screwing with this (which is why I think I did the include in the first place). I have to go to work tonight and won't be able to look closer until later tomorrow night. In the meantime, here's the working page:
Hide Form Data With Data Form Templates
-Ed
Community Admin