Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
Inner field calculation [phpwcms-HowTo:wiki]

Strict Standards: Declaration of syntax_plugin_code::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/code/syntax.php on line 41

Strict Standards: Declaration of syntax_plugin_tip::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/tip/syntax.php on line 38

Inner field calculation

FIXME translate

http://forum.phpwcms.org/viewtopic.php?p=111914#p111914

Re: Is there a way to calculate with form fields?

Posted by Oliver Georgi on Tue Dec 16, 2008 18:30
A simple approach how to get this going is making use of (just an example):

a) 1 x hidden field (hidden_field_name) within your form → this will be the target for your calculation and will be taken over into your mail form then. b) additionally a frontend_init script “my_form_init.php”:

 if(isset($_POST['fieldname'])) {
  // hier die Berechnung durchführen - an der Stelle ganz beispielhaft realisiert.
  $_POST['hidden_field_name'] = xss_clean($_POST['fieldname']) * 1000;
}




Example 01

I'm setting up a site for a customer who will add a lot of articles describing different products. I don't want him(my customer) to set up a form for every product.
I want to “call” a form from the template with some sort of identification of the current article.

This is described also a thousand times inside the forum - working like “send a friend”.
Use an article with content part based on your needs outside public access.
Then use {SHOW_CONTENT:CP,ID} (ID = ID of the content part form) inside of your template.
It's no “out of the box” solution - but as I said it is discussed somewhere here in the forum.

Finish

FIXME translate

Create the file /template/inc_script/frontend_init/check.php
<?php
if(isset($_POST['eingabe'])) {
  // do your calculation here - this is an example.
  $_POST['versteckt'] = xss_clean($_POST['eingabe']) * 1000;
}
?>
Now you can do your calculations.
In our example the field input is multiplied by 1000, while the output is showing the input value and the result.

Insert a default for the hidden field (hidden). Define this field as “required”.
(If an error is encountered, set the field value to ”” ($_POST['my_hidden_field'] = ””;) ).

Result: Error → if the value is validating, then the hidden field value will too contain the valid result.
english/phpwcms-system/article/contentparts/form/special-applications/inner-field-calculation.txt · Last modified: 2009/05/22 13:26 by Claus
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79