Join Now

Click here to join our
growing community:



Welcome Tour
Pro Modules

Copyright © 2020
Terms of Use
Privacy Policy



The savedata command takes a comma separated list of field names and saves each of their values to the target page as data variables.

This command looks for a page parameter. If not found, it defaults to the current page. The command accepts pageshortcuts. See that tutorial for more details.

Here's what a basic form looks like:

Book Title: [text title]
Author: [text author]
Published: [text published]
[command savedata title,author,published page=book.#]

The user is prompted to enter a book title, author, and date of publication. The page shortcut in this example tries to create a page at book.1000. If that exists, it tries book.1001. If that exists, book.1002 and so on until it finds an available name. There will be no content on this page, only three data fields.

We could make this example more interesting by allowing the user to enter a brief description of the book and save that for the page content. It can be a separate form, or more logically, combined with this:

Book Title: [text title]
Author: [text author]
Published: [text published]

[box description rows=5 cols=40][box]
[command nextpage book.#]
[command savedata title,author,published page={=nextpage}]
[command edit {=description} page={=nextpage}]

By using the nextpage command I accomplish two things. First, I ensure both savedata and edit save do their work on the same page. If I used page=book.# in both, the data would be saved on book.1000, and the content on book.1001. Second it forwards the user to the new page as soon as they submit the form. That page would show the description in the body of the page, but not any of the data values. To fix this create a header page (book.header):

[if number {p}]! Favorite Books
Title: {:title}
Author: {:author}
Published: {:published}


When a page like book.1000 is visited, the data values are all fetched and displayed by the header, and the description is shown below in the main body of the page. The conditional makes sure the header is not shown on the main book page (which could be a list of all the books in the group), a page, headers, footers, etc.

Suppose you want to be able to edit a page? I could create an action page called action.editbook and then call it by generating a link like [[book.1000&action=editbook]].

The form would look similar to the page creation form, except I need to pull in existing data values, and I need to make sure I save them to the current page (rather than create a new one):

Book Title: [text title '{:title}']
Author: [text author '{:author}']
Published: [text published '{:published}']

[box description rows=5 cols=40]<(source {p}:description)>[box]
[command savedata title,author,published]
[command edit {=description}]

Because this is action page layered over an existing book page, I don't need to specify the page anywhere in the form (except the source function). It also automatically returns to the page to show the changes.

To put an edit button on every page I might create a footer page (book.footer) with content like the following:

[if number {p} && editor][form][submit][command nextpage {p}&action=bookedit][form][if]

If an editor views the book page, it shows the button and clicking it calls the special action page allowing them to edit both the data values and the content of the page.


You need to have write permission to save data to a page, and data authorization to save specific fields. That is, site.auth.write defines which pages you can save data on, and which fields.

By default, most pages are editable to members. If you wish limit that further, or allow non-members to save data values use the authkey command on specific forms. Normally, you control access to who can save data to a page by controlling who has access to the forms that save your data.

By default, the page only limits access to the password and email fields. It also controls which fields are visible to a user.

For more information about authorizations, please see the tutorial.

Info Mode

The savedata command can actually save the specified fields as info vars rather than data vars by setting mode=info. This has the advantage of allowing you to save multiple values at one time.