[pmwiki-users] PmForm won't save data to page
Knut Alboldt
pmwiki at alboldt.de
Sat Dec 29 14:28:48 CST 2007
Hi !
I tried to use pmform (instead of ZAP) to support form-input for some
datapages.
Tried the samples, worked well.
Extended some of the definition, now I get the problem, that the data
aren't written back any more.
Implemented a trace in pmform.php and found out that the call of
UpdatePage($pagename,$old,$new) was ok, $old contained the right old
data (eg var=1), $new the new data (e.g. var=2 entered via the form).
But having a look in tha page's file: nothing had changed, stil
containing "var=1". So it wasn't read by the (:input source= ..:)-markup
when the form was displayed the nex time.
Second try:
Changed "var" from "1" to "3"
The next Trace of UpdatePage() shows the previous entered data (var=2)
in the $old-Array although it wasn't saved in the page-file (!) and the
last entered data (var=3) in the $new-array.
But again the page's file still contains "var=1".
Has it something to do with caching, etc ?
When I change the data in the page-file manually, the changed value is
taken over whith the next display of the form, that's all ok.
Could anybody please help ?
Thanks in advance, Knut
The pmform-Definitions are as follows:
test.php (group's config):
<?php
$PmForm['testsavedata'] = 'form=#testsavedataform fmt=#testsavedata';
?>
Form-Definitions in Site.PmFormTemplates
!! #testdataform
[@
[[#testsavedataform]]
(:input pmform target={$$target} :)
(:XXinput default request=1 :)
(:messages:)
(:input default source={$FullName} :)
(:table:)
(:cellnr:)Selectfield:
(:cell:)
(:input select $:Selectfield value='Option 1' :)
(:input select $:Selectfield value='Option 2' :)
(:input select S:Selectfield value='Option 3' :)
(:input select S:Selectfield value='Option 4' :)
(:cellnr:)Textfield:
(:cell:)
(:input text $:Textfield size=25 :)
(:cellnr:)Radiofield:
(:cell:)
(:input radio $:Radiofield yes:) Yes
(:input radio $:Radiofield no:) No
(:cellnr:)Checkboxfields:
(:cell:)
(:input checkbox $:CheckboxfieldRed 1:) Red
(:input checkbox $:CheckboxfieldBlue 1:) Blue
(:input checkbox $:CheckboxfieldGreen 1:) Green
(:cellnr:)Textareafield:
(:cell:)
(:input textarea $:Textareafield cols=50 rows=6 :)
(:cellnr:)
(:cell:)(:input submit :)
(:tableend:)
(:input end:)
----
Text outside the input form
* Data-Source={$FullName}
* Selectfield={$:Selectfield}
* CheckboxfieldRed={$:CheckboxfieldRed}
[[#testsavedataformend]]
@]
[@
[[#testsavedata]]
(:template require $:Selectfield errmsg="$[Missing 'Selectfield' value]" :)
(:template require $:Textfield errmsg="$[Missing 'textfield' value]" :)
(:template require $:Radiofield errmsg="$[Missing 'Radiofield' value]" :)
(:template require $:Textareafield errmsg="$[Missing 'Textareafield'
value]" :)
(:template defaults
savevars=$:Selectfield,$:Textfield,$:Radiofield,$:CheckboxfieldRed,$:CheckboxfieldBlue,$:CheckboxfieldGreen,$:Textareafield
:)
(:template defaults saveto={*$FullName} :)
[[#testsavedataend]]
@]
Test.GroupHeader:
(:if name Test.PmForm*:)
! PMForm-Call
(:pmform testsavedata:)
|| border=0
----
! Test Data Output (for Trace only !)
* Selectfield: {$:Selectfield}
* Textfield: {$:Textfield}
* Radiofield: {$:Radiofield}
* Checkboxfields: Red={$:CheckboxfieldRed} Green={$:CheckboxfieldGreen}
Blue={$:CheckboxfieldBlue}
* Textareafield: {$:Textareafield}
(:if:)
Page containg Testdata = test.PmForm01
! saved data
(:Selectfield:Option 3:)
(:Textareafield:Textareavalue Line 22
# Line 2
# Line 3
* Line 4
** Line 55:)
(:Radiofield:yes:)
(:Textfield:Textfieldvalue 33:)
(:CheckboxfieldRed: 1:)
(:CheckboxfieldBlue: :)
(:CheckboxfieldGreen: :)
!! Additional Data
* Additional data: {$:AdditionalField}
(:AdditionalField:Value Additional Field:)
More information about the pmwiki-users
mailing list