<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Thanks to all of you that replied.<br>
<br>
Eemeli Aro caught one small mistake which was that I had forgotten
to set $FmtPV as a <b>global </b>in my script.<br>
<br>
Everyone was curious to know why I didn't use some other method
within my page text. The reason is simple (as implied by mere
mention of writing a script). The variables are being dynamically
generated - the PmForm has no way to know what the variables will be
or what their default values will be until my script has injected
them in to the page - hence cannot be placed directly in the wiki
page. In fact, the entire wiki page is dynamically generated by
another recipe that I wrote. The actual Wiki Page only has a simple
line of code in it:<br>
<br>
<tt><b><font color="#006600">(:order id=product_id title="Product
Title" description="Longer product description"
price1="$15.00" price2="$25.00" shipping="$4.95"
other_option_variables="values":)</font></b></tt><br>
<br>
Using that one line of code I'm able to populate the page with a
very elaborate product order form. The end result of the (:order:)
directive is actually what plants the (:pmform:) directive on the
page (complete with several dynamically created Page Vars that are
now injected in to the form when it's rendered!<br>
<br>
This little problem of <b>PageVars </b>was actually a small piece
of the puzzle for a larger problem which I posted about a week ago
which was how I could "inject" my own form fileds in to a PmForm. I
decided to break the problem down in to smaller parts, hence my
other recent posts:<br>
<blockquote>Re: [pmwiki-devel] PmForm - Need a little help<br>
Re: [pmwiki-devel] Working with uploads / attachments /
$UploadPrefixFmt<br>
Re: [pmwiki-devel] Page Vars - A Little Help?<br>
<br>
</blockquote>
I finally have all the pieces I need to make this all work together!<br>
<br>
Thanks again to everyone who replied. You all helped me work
through the logic, and eventually I was able to solve the problem.<br>
<br>
For those that are curious, here's some end-result of my (test)
coding efforts which is actually working.<br>
<br>
In my test script:<br>
<br>
STEP 1 - My script<br>
<pre wrap=""><b><font color="#006600">my_function($args)
<span class="moz-txt-citetags"> </span>{
global $FmtPV;
<span class="moz-txt-citetags"> </span>$my_vars = ParseArgs($args);
<span class="moz-txt-citetags"> </span>if (isset($my_vars['price']))
<span class="moz-txt-citetags"> </span>{
<span class="moz-txt-citetags"> </span> // set page variable for 'price'
</font><font color="#006600"><span class="moz-txt-citetags"> </span> $price = $my_vars['price'];
<span class="moz-txt-citetags"> </span> $FmtPV['$price'] = "'$price'";
<span class="moz-txt-citetags"> </span>}
<span class="moz-txt-citetags"> </span>return "(:pmform orderform:)";
<span class="moz-txt-citetags"></span>}</font></b>
</pre>
<br>
Now that I have this working, I create my PmForm template in
Site.LocalTemplates. I am then able to set any number of page
variables (from my script) and I can generate customized forms with
pre-filled (dynamic) data using only the one PmForm template. <br>
<br>
By using (:if:) statements in the PmForm template I can
conditionally include or exclude fields from my form.<br>
<br>
Snippet / Example of a form template which may or may not include a
form field. This form has the following Page Var's defined:
$product_id, $product_image_url, $product_title and
$product_description.<br>
<br>
<b><span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: 'Century
Gothic',Arial,Helvetica,sans-serif; font-size: 15px;"></span></span></b><font
color="#006600"><tt><b>[[#orderform]]<br>
(:input default request=1:)<br>
(:input pmform target={$$target} successpage={$$successpage}
:)<br>
(:template defaults successpage='Main/ThankYouForYourOrder' :)<br>
<br>
(:input hidden product_id <font color="#006600">{$product_id}</font>:)<br>
(:input hidden product_image_url "{$product_image_url}":)<br>
<br>
(:if !equal {$product_image_url} '':)<br>
Attach:{$Group}/{$Name}/{$product_id}.jpg<br>
(:ifend:)<br>
<br>
!{$product_title}<br>
{$product_description}<br>
<br>
... <br>
<br>
(:input submit name=post value='$[Send]':)<br>
(:input end:)<br>
[[#orderformend]]<br>
<br>
<br>
<br>
</b></tt></font>You can see I've made extensive use of
{$page_vars} here. All of these have been transplanted on the page
from my script which was triggered before the (:pmform:) directive.
With the use of (:if:) statements in the form template itself, I can
check to see if those variables are set (or not), and decide if I
should display them (or not).<br>
<br>
I was also able to use PmForms email option to send a HTML version
of the completed order form complete with a picture of the product
and the company logo. This was accomplished by adding a few extra
lines in my config.php file to anable text/html e-mails:<br>
<br>
<b><font color="#006600"><tt>$PmFormMailHeaders = 'MIME-Version:
1.0' . "\r\n";<br>
$PmFormMailHeaders .= 'Content-type: text/html;
charset=iso-8859-1' . "\r\n";</tt></font></b><br>
<br>
Very please with the final product. Ones I get all the bugs worked
out, and proper documentation done I'll upload it to the Cookbook
area.<br>
<br>
Again, thank to all who replied! Although some responses were not
as helpful as others, all responses were <b>equally </b>appreciated!<br>
<br>
Best Regards,<br>
<br>
Steven Leite <br>
</body>
</html>