Hide Form Data With Data Form Templates

Posted by Ed Johnson on 08 Mar 2010 19:17, last edited by Ed Johnson on 30 Mar 2010 23:43


rating: +2+x

Special thanks to James KanjoJames Kanjo and leigerleiger 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 --]
    label: Member name
    label: Email address
    label: Get newsletter?
      0: No
      1: Yes
    default: 1
    label: Address
    width: 30
    width: 30
    width: 30

Related articles


Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.