====== Formular Plugin Documentation ====== ---- plugin ---- description: Lets you create custom input forms. author : Ole Rienow email : wikiform@rienow.eu type : syntax lastupdate : 2009-03-12 compatible : 2008-05-05, !Hrun depends : conflicts : similar : contactmodern tags : form downloadurl: http://rienow.eu/dokuwiki/formular.tar ---- ^ Download | http://rienow.eu/dokuwiki/formular.tar | Note: this is the Formular plugin by Ole Rienow, not Form plugin by Esther Brunner. ===== Recent Changes: ===== * 2008-07-20 -- Hold Data in Selectboxes, Radiobuttons and Checkboxes as well - also GET-Parameters for this available * 2008-07-19 -- Added File-Upload for sending MIME-Mails with Attachment * 2008-07-18 -- Hold old Data if Constraint is not fulfilled * 2008-07-09 -- Local wikipage language added (Hidden lang "en";) * 2008-07-03 -- Constraints for self written Scripts, Username in Mail, Grepnot Constraint * 2008-06-29 -- You can hand over GET-Parameters as Standard Values for Textfields and Textareas * 2009-03-12 -- little bugfix of missing quotation mark in textareas / new Italian translation - thanks to Diego Pierotto ===== Installation: ===== I advice to use the plugin manager. Simply add http://rienow.eu/dokuwiki/formular.tar. However if you can't use it get the tar file and extract it to your plugin directory lib/plugin/.\\ ==== Config: ==== You can set the config parameter using the configuration manager. There you should change the Mail-Address of the sender. \\ You can change the layout of the forms by changing the style.css in your plugin directory. ==== Note for Windows user ==== - The Email Sender has to be set - You need an element named submit. For example: Hidden submit "null"; ===== Header: ===== ==== Create a Form and call PHP-Script: ====
===== Examples ===== ==== Simple Mail Form ==== ==== Extended Mail Form ==== ==== Simple Link ==== ===== Feedback ===== ==== Feature Requests ===== The plugin works great, thanks for it! \\ One little flaw though: when you check the contents of the form with constraints and get an error (e.g. 'e-mail address not valid'), you are taken back to an empty/blank form which is very annoying - you have to fill in all the text again. Is there any solution to this? Alexander 2007/07/30 This is done from Version 2008-07-19 on. Ole I am using the right version but errors are not printed and Forms keep empty. Please notice that the messages were posted (so the main functions working). --- // Julien 2008/10/15 21:34// ---- Hi, I don't know if I'm in the right area to edit, but, okay, could there be a bug in your application to do with caching in certain instances? with constraints my forms don't seem to be working and certain values seem to 'stick' as if they're cached because there are no URI variables for $_GET to grab onto anymore but the values remain, which could only mean a caching issue, but, I see caching is meant to be switched off... Please think this over. --- // William 2008/08/13 16:57// === Suggestion: Send email message in UTF-8 format ===
.'mail($receipt, \''.$subject.'\', $string, $from);'
.'mail($receipt, \''.$subject.'\', $string, $from."\nContent-Type: text/plain; charset=UTF-8; format=flowed\n");'
\\
I found this from [[http://fi.php.net/manual/en/function.mail.php
|PHP manual for mail-function]] (Search for 'UTF-8').
--- // Ciove 2008/07/01 //
Added something similar to official version
Ole
Update: From Version 2008-07-19 MIME-Mails are sent because of the file-upload feature.
Ole
Hi, Ole
Does the update you've mentioned above mean that the text in e-mail message cannot be charset=UTF-8? According to my tests this does not corrupt the message or the attachment file?
Thanks again for a great plugin.
--- // Ciove 2008/10/01 //
=== Suggestion: MailAlsoTo and MailSubject elements ===
MailAlsoTo-element would be a special Textbox-element and/or Hidden-element, and it would add to address to CC-field (Carbon Copy) of e-mail message.
MailSubject-element would be a special Textbox-element and/or Hidden-element, which would override the mailFrom-setting in /lib/plugins/formular/conf/default.php.
--- // Ciove 2008/10/01 //
=== Suggestion: Default values to text elements ===
One more parameter to text elements ((Static, Textbox, Passbox, Textarea and Hidden, maybe to MailAlsoTo and MailSubject elements if you agree to do them.)): **Default value**.
The element syntax could look like this:
Textbox My_field "My field" 16 value="My default text";
This would be generated to HTML like this:
My field
--- // Ciove 2008/10/02 //
=== Question about the handover / Get-Variable function for text elements ===
You [[plugin:form#textbox|wrote]] that the 2008/06/29 version supports preset values in the text elements. Unfortunately, I don't understand how it works. I tried these //**unsuccessfully**//:
* Add the ''?fieldname=value'' string to the end of the address field of my browser.
* Modify the code:
Textbox testfield "My test field:" 500 ?testfield=values;
--- // Ciove 2008/07/01 //
Hi Ciove,
I changed the text so I hope you can understand it better now. You don't have to change anything on the wiki.
Just handover a Get-Parameter through your URL. The name of the Parameter has to be the name of the
element and the value is the displayed text in that field.
Greetings Ole
----
Hi Ole.
Thanks for clarification, I understood it now. However, this feature does not work in my wiki. My environment is W2k3/IIS, PHP Version 5.2.4. I've tested with DokuWiki version 2008-05-05.
--- // Ciove 2008/07/10 //
----
Hi Ciove,
please check again with the newest version. If it does not work please send me a mail to sort things out.
Ole
----
Hi Ole.
Thanks for the plugin, it's very useful, but I cannot use the feature described above on my wiki, as well. Seems that the _GET array is every time empty and I cannot see any data inside the elements both when I try to add in the URL and when the page turn back after a constraint not respected. In the second case, any error is displayed and any element hold the data.
Am I missing some configuration in PHP? If you need testing, I can give you an URL (by e-mail) to reach mi Wiki testing copy.
Thanks in advance.
--- // Daniele 2008/09/03 //
=== Question : Select Constraints ===
* Q. : How do I setup a constraint to check that a user filled out a Select field? i.e. make it a required one? I tried ''grepnot'' for ''/n\/a/'', but it didn't work. thanks in advance! ---//2008-08-05//
=== suggestion concerning hard-coded styling elements ===
The styling of most elements of the plugin can easily be influenced via CSS as subelements of ''some error message |
. "\n".' $back .= $key_name . "=". utf8decode($key_value) . "&";'
>to:
>. "\n".' $back .= $key_name . "=". utf8_decode($key_value) . "&";'
>--- // Christian 2009/06/09 //
>>Thanks for clarifying this!
>>Worked perfectly for me.
>>Cheers, Thomas
>>//2009/21/09//
==== Tips ====
Hint. I got the %%"You don't have permission to access /data/formplugin/form_feedback.php on this serve"%% on Apache. I solved the problem by adding following to the Apache configuration.
Notice: Undefined index: submit in [PathToDokuWiki]\data\formplugin\form_testing.php on line 50
However the Submit -command (or element) works OK without ''Hidden submit "null";''.
=== Sendmail ===
In Windows, to be able to send email from DokuWiki and other .php applications, you need to install software that emulates sendmail in Linux. Here's my suggestion:
* Copy [[http://glob.com.au/sendmail/|Fake sendmail for windows]] and unzip it to your PHP-folder, mine is in C:\php\sendmail.
* Edit C:\php\sendmail\sendmail.ini to match your SMTP-server.
* Add C:\php\sendmail -path to path environment variables ((Right-click MyComputer, Properties, Advanced, Environment variables, System variables, select Path -variable, Edit, Add ''**;C:\php\sendmail**'' to the end of the Variable Value field)).
* Edit ''[mail function]'' section in C:\php\php.ini:
* ''SMTP = //your.smtp.domain.com//''
* ''smtp_port = 25''
* ''sendmail_from = //senders.address@domain.com//''
===Add Data===
Is there a way to use this plugin to add data to a wiki page? In other words, is there a way to set up the form to show on a wiki entry and when the user fills out the form the data is added to the page in question? In addition is there a way to use the form for editing pages?
Thanks
YES. Post to a PHP form and use fopen(); fwrite(); and fread(); to open the path to the page you want to alter fwrite to write your changes. The PHP manual on php.net has some examples...
UPDATE (03/19/2009,
...and in your doku.php, you'd have to hand edit...
(at top)
// you will create "inc/form_processor.php" and add the function "TestForm"
// to process your form
if ($_REQUEST['FormType']) require_once(DOKU_INC.'inc/form_processor.php');
(further down... after "import variables")
// this calls the function "TestForm", which (of course) lives in form_processor.php
if ($_REQUEST['FormType']) { $_REQUEST['FormType'](); }
Now you can modify "global $ID" from within form_processor.php, do anything you want to process the form fields (as $_REQUEST['blah'] variables), and return nicely to your wiki.
=== Problem 403 ===
Hi. I have a problem. When I click "proceed" I get an 403 Error. My formular-file data/formplugin/ and all subfolders have 755 as permission to execute all PHP files.
Help!
----
I am also getting the 403 error. Hosted on a LAMP server yet the mail never sends and I cant figure out why not! Anyone have any ideas?! Thanks.
----
>me too
----
Hi, I have also the same problem. What is the meaning of data/formplugin? Thanks.
----
**In the data folder there is a .htaccess file, if you change "deny all" to "allow all" you will no longer receive a 403. However this does allow anybody access to your data folder and all files in it. So use this with caution. We are working on a permanent fix for this and will get back with the solution shortly**
--- //Gary Greyling 2009/07/20 11:17//
**I implemented a quick fix on Gary's request, which involves adding a proxy php file for form submit and changed the plugin to render the form to submit to the proxy page. After these changes, you can set the .htaccess back to deny all**
create a proxy php file called "submit.php" inside the plugin folder
$path = explode('=',$_SERVER['HTTP_REFERER']);
$path = explode('&',$path[1]);
$path = $path[0];
$path = explode(':',$path);
$submitpath = '';
for($i=0;$i
modify the syntax.php, change the line
$action = DOKU_URL . $this->mailFile;
to
$action = DOKU_URL . 'lib/plugins/formular/submit.php';
--- //James Lin 2009/07/20 12:42//
I was unable to get James workaround to function properly. So I just added a .htaccess file to the formplugin data directory that allows all.
---//Rob Vice 2011/08/02 3:04//
===Get Variables ===
Hello!
My provider does not support simple get variables, in my special script I have to rewrite each e.g. $subject to $subject=$_POST['subject']; only after that mail($to, $subject, $message) sends me e-mails, but the automatically created PHP file only uses the simple variables. (The conf of the server is register_globals on OFF.) I do not know what to do, because the PHP file seems to be rewritten after every change of the form, so that it is useless to change it by hand via ftp.
Handing over of get variables does not work either, I typed it everywhere e.g: http://roomsixhu.beerdrinkers.eu/doku.php?id=literatur:form2&to=roomsixhu@freenet.de (with quotes, too or [[literatur:form2&to=roomsixhu@freenet.de]], to set the address. Probably my PHP skills are too weak. I will read a tutorial these days.
Cheers Roomsixhu
Hello, further if I place NEXT before PHP (with my own mail.php) without MAILTO no mail is sent at all, otherwise if PHP is first, redirection does not work. Cheers, Roomsixhu
===Problem with Constrains ===
Hi,
i set constrains and they work. Only if there is a email in the adressfield it will be send. But if there is no email it will only reload the startpage and not show a warning message or anything else. How could I change this?
> I find the problem and the solution. My first problem is I change the [[:rewrite|rewrite]] of DokuWiki to the one with the value 2 and this plugin always insert something like "doku.php" and so my wiki jump to the first site. I change this in the syntax.php at line 723 ... I have deactivate this line. Maybe the developer could put in the new version an option to de/activate this in the configuration?
===Problem with Caching ===
Hi,
every time one Constrains happen no errormessage was shown. So I prove the url and all things fine. But if I add something like &purge I see an error message. So I activate Hidden dokupage "";
to Hidden dokupage "&purge";
And then it worked.
>I solved it in an even easier way after reading your hint:
>
>This generates the //empty// entry
>purge =>
>in the generated mails (if it is a mail form) but I can very well live with that.
>Having said that, I would of course be happy about a general solution of the caching problem in the plugin.
>
>--- //Thomas 2009/21/09 //
=== GET or Caching problems workaround ===
It's not clean, but it works for me...
function render($mode, &$renderer, $data) {
if ($mode == 'xhtml') {
$renderer->info['cache'] = false;
if (isset($_GET['error'])) {
$data = str_replace('',
''.$_GET['error'].' ', $data);
}
$blacklist=array("error","id");
foreach($_GET as $key_name => $key_value) {
if ($key_value == "" || in_array($key_name, $blacklist)) continue;
$data = str_replace('name="'.$key_name.'"', 'name="'.$key_name.'" value="'.$key_value.'"', $data);
}
$renderer->doc .= $data;
return true;
}
return false;
}
--- //Ondra Kotek 2009/08/06 12:16//