[pmwiki-users] EnableDrafts and PmForm

Petko Yotov 5ko at 5ko.fr
Tue Dec 9 15:05:09 CST 2014

Could you please double check that after you press "Save draft" then 
open the non-draft page, you have actually opened the *non-draft* page? 
If you simply click on the "edit" link for the non-draft page, and there 
is a draft page, PmWiki actually opens the draft page for editing - this 
is normal and expected.

For me the "save draft" button updates only the draft page. Here are my 
two pmform templates:

(:input pmform target=savedata :)
(:input default source={*$FullName}-Draft,{*$FullName} :)
(:input default request=1 :)
|| Name:||(:input text $:name size=25 :) ||
|| Email:||(:input text $:email size=25 :) ||
(:input submit post Save:)
(:if auth admin:)
(:input submit postdraft "Save draft":)
(:input hidden postdraft 1:)
(:input end:)
* '''{*$FullName}''': Name={{*$FullName}$:name}, 
* '''{*$FullName}-Draft''': Name={{*$FullName}-Draft$:name}, 

(:template defaults savevars=$:name,$:email :)

Near the end of the #dataform snippet, I placed the variables from both 
the draft page and the public page, just to see if it works. As admin, 
when I press "Save draft", only the draft variables are created or 
modified. When I press "Save", the draft page is deleted and the public 
page variables are updated.

Note also that, if there is a draft page, with the line

    (:input default source={*$FullName}-Draft,{*$FullName} :)

the form is pre-filled with the variables from the draft page, this is 
also normal and expected.


On 09.12.2014 20:51, Criss Ittermann wrote:
> Hi, Just a reminder, and clarification if it isn't clear:
> this partly works:
> a -Draft is created.
> the webpage DOES pre-populate with -Draft data over the original page
> data.
> The unprivileged editor only sees 1 button, as desired.
> However the buttons behave identically, updating both the normal page
> AND draft page whether submitted as admin or as unprivileged editor.
> So the buttons behave exactly the same and update both pages.
> Crisses
>> On Nov 19, 2014, at 8:44 AM, Criss Ittermann <crisses at kinhost.org>
>> wrote:
>> I updated forms.php and drafts.php from svn.
>> I changed the button-end of my profile PmForm to:
>> (:input submit post Save:)
>> (:if auth admin:)
>> (:input submit postdraft "Save draft":)
>> (:else:)
>> (:input hidden postdraft 1:)
>> (:if:)
>> (:input end:)
>> [[#profileformend]]
>> Per the emailed instructions.
>> When I'm logged in as admin, "Save" and "Save Draft" both save to
>> the Profile's Data (_and_ Draft) page.
>> Same when logged in as non-admin, only there's just one "Save"
>> button.
>> So it's creating/updating both, populated with the same data.
>> By manually changing the -Draft, I can tell the form is correctly
>> pre-populating from the Draft page.
>> Thank you for the new feature (in progress)!
>> Criss IttermannBusiness Coach, Eclectic Tech LLC
>> http://EclecticTech.net/Events/ [1]
>> 845-820-0262
>> On Nov 13, 2014, at 4:05 PM, Petko Yotov <5ko at 5ko.fr> wrote:
>> On 12.11.2014 19:56, Petko Yotov wrote:
>> To be clear, only the posting and saving to a draft page can be
>> configured. Opening a PmForm on an existing page will display the
>> data
>> from the real page, not from an existing draft page.
>> Well, I committed to Subversion a change that would allow to define
>> more than one source= pages in input default. One could write:
>> (:input default source={*$FullName}-Draft,{*$FullName}:)
>> Then the values will be taken from the first page which exists and
>> for which the user has read permissions.
>> This needs testing so please get the forms.php file, test the
>> feature and report any problems.
>> Petko

More information about the pmwiki-users mailing list