Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 25, 2012, 11:18:31 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
155499
Posts in
21710
Topics by
7736
Members
Latest Member:
deenangle
WebsiteBaker Community Forum
English
Modules
(Moderator:
Argos
)
Stable version of MPForm ( Multi Purpose Form)
Pages:
1
...
6
7
[
8
]
Go Down
Author
Topic: Stable version of MPForm ( Multi Purpose Form) (Read 24256 times)
BlackBird
AddOn Development
Offline
Posts: 2069
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #175 on:
July 08, 2011, 09:50:12 AM »
Quote from: YoJoe on July 08, 2011, 07:41:00 AM
Is there a way to duplicate created forms from within admin panel ?
You can use the Import-Export-Tool from the same author.
http://wbdemo.heysoft.de/pages/de/export-import.php
(DE)
http://wbdemo.heysoft.de/pages/en/export---import.php?lang=EN
(EN)
I've already used it with MPForm (to "translate" a larger form into another language), works okay.
Logged
Alle großen Veränderungen beginnen im Kleinen
YoJoe
Offline
Posts: 74
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #176 on:
July 08, 2011, 12:24:09 PM »
Quote from: BlackBird on July 08, 2011, 09:50:12 AM
You can use the Import-Export-Tool from the same author.
I've already used it with MPForm (to "translate" a larger form into another language), works okay.
ohhh I'm glad to hear that.
I was browsing mpform website yesterday but I thought I don't need a page duplicator, but something working only on forms or page sections.
thx for tip
Logged
WuJitsu
-
in web I trust
BlackBird
AddOn Development
Offline
Posts: 2069
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #177 on:
July 08, 2011, 12:33:55 PM »
I don't know if PageCloner works also, just can say for Import/Export.
Logged
Alle großen Veränderungen beginnen im Kleinen
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #178 on:
October 04, 2011, 11:25:48 PM »
I want to use MPForm with automatically selected options, based on the referring page.
I'm building a site for an educational institute that offers many different courses, etc. Each course has its own page with info. On each page there is a button "I want to take this course". Clicking the button now leads to a general form on which the visitor needs to look up the specific course he/she wants to take and select a checkbox. That's kind of inefficient and annoying.
It would be better that the form already has the preferred course automatically selected in a selection menu or checkbox or something, so that the visitor doesn't need to look it up again. So the form needs to receive some parameter that links it to the referring page.
Now, I looked in the support docs of MPForm, and based on the info in the FAQ I have a feeling that it must be possible, but I don't know how. Can anyone shed some light on this?
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #179 on:
October 05, 2011, 03:05:24 AM »
Hi,
Quote from: Argos on October 04, 2011, 11:25:48 PM
Now, I looked in the support docs of MPForm, and based on the info in the FAQ I have a feeling that it must be possible, but I don't know how. Can anyone shed some light on this?
Your feeling doesn't lie. I assume the button is a send button with action leads to the overview which check boxes, right? Just put a code section on each page with a button and use
Code:
$_SESSION['field42']=array('eins','zwei');
where you use the field id (found mine in page source code) and the names of the values of the checkboxes. It's useful to not predefine a box as checked. I append a screenshot of my installation. For my form the code was:
Code:
$_SESSION['field5']=array('A','C');
regards
Logged
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #180 on:
October 05, 2011, 11:28:12 PM »
Thank you. I first didn't quite understand what you meant (not your fault, I'm just no coder), but after some fiddling around I finally got it
It works fine, but is a rather crude and laboursome method if you have to do that for many dozens of pages. Isn't there a way of putting 1 piece of code in the template that routes the form input? I tried this, but it doesn't do anything.
Code:
<?php
if (
REFERRER_ID
==
221
) {
$_SESSION
[
'field63'
]=
'Option A'
;
}
?>
«
Last Edit: October 07, 2011, 12:17:51 PM by Argos
»
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #181 on:
October 07, 2011, 12:57:06 PM »
Hi,
thank you for thinking twice about my previous post. As it takes some time to think about and post I'm sometimes dissapointed if the reader doesn't seem to read it attentively
.
In my opinon it doesn't make so much difference to edit every page compared to editing the form page, as you have to assign each page to an option. (Maybe an idea would be to include the option name into the site name, then the assignment coud be done automatically).
But obviously you don't like this too much. So you coud insert a code section before the form seciton or edit the "private_function_be
fore_new_form" as described in the MPForm FAQ. Use the following code:
Code:
$ref = basename($_SERVER['HTTP_REFERER']);
echo $ref;
switch ($ref) {
case "site1.php":
$_SESSION['field5']=array('A');
break;
case "site2.php":
$_SESSION['field5']=array('B');
break;
default:
$_SESSION['field5']=array();
break;
}
Of course you have to edit the field and option name for your site. If you really need the page id you could get it from the wb database. Or think about my suggestion about including the option name into the name of the refering page, then you can extract it for setting the option variable.
There might be some issues with the refering page as some browser /server constellations don't provide it. In my testing everything worked fine so far.
regards
Logged
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #182 on:
October 07, 2011, 01:48:56 PM »
Hi marmot, thank you very much for the info! I don't understand it fully the first time I read it, but I will study and try to get it to work. Like you said, often you have to put effort in it to try and understand as much as possibel, even if you're not a coder
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #183 on:
October 08, 2011, 12:11:06 AM »
Hi marmot,
that works fine again, thank you for your support!
However, using the option names and page names is a bit too risky and too much work. My client has dozens of trainings and on a regular basis new ones are added and old ones are deleted or renamed. So it's kinda dynamic stuff. The more automatic it's set up, the better. That's why I suggested page ID's as a basis, so that name changes don't matter and the chance of typo's and errors is less.
But if somehow things can be done automatically, that would be best. I would love to use page ID's and extracted page titles as a basis. So instead of:
Code:
case "course-customer-management-leadership-mba.php":
$_SESSION['field5']=array('Customer Management Leadership MBA');
break;
I would like to use something like:
Code:
case "223":
$_SESSION['field5']=array('THE EXTRACTED PAGE TITLE OF PAGE WITH ID 223');
break;
Would that be possible?
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #184 on:
October 08, 2011, 02:38:50 AM »
HI,
Quote from: Argos on October 08, 2011, 12:11:06 AM
That's why I suggested page ID's as a basis, so that name changes don't matter and the chance of typo's and errors is less.
But if somehow things can be done automatically, that would be best. I would love to use page ID's and extracted page titles as a basis.
I would like to use something like:
Code:
case "223":
$_SESSION['field5']=array('THE EXTRACTED PAGE TITLE OF PAGE WITH ID 223');
break;
hmm, in your example the option name (on form page) has to be the name of the refering site, or do I get you wrong? That's what I suggested in my previous post but you still have to take care of the option name on form page. If someone changes the site name the form page has to be edited as well. In my opinion this makes sense, as the customer may want to find the name of the course again on the form page to be sure he gets the right one but it doesn't help you regarding name changes and typos. Then you can leave the case stuff in code completely:
Code:
$ref = basename($_SERVER['HTTP_REFERER'],".php");
$_SESSION['field5']=array($ref);
I'm afraid this does not work with spaces in the site name and only with lower case charcters.
But I'm not sure if that's how you want to do it. I dont't know what you mean with "Extracted Page Title". Where do you want to extract it from? Maybe think about these two points:
1.) As far as I know you only get the title of the refering page and not the page id. If you want to get the page ID you can either send it by post or get when clicking the send button on the refering page or look it up in wb database.
2.) If you don't use the page ID as option name, you always have to edit form page when the name of the site changes and therfore there's a higher risk of typos.
Hmm, ok also it doesn't really make sense, here is the code like you suggested:
Code:
$ref = basename($_SERVER['HTTP_REFERER'],".php");
$query = "SELECT `page_id`, `page_title` FROM `".TABLE_PREFIX."pages` WHERE `link`='/".$ref."'";
$result = mysql_query($query);
$line = mysql_fetch_array($result);
$id = $line['page_id'];
switch ($id) {
case 2:
$_SESSION['field5']=array($line['page_title']);
break;
case 3:
$_SESSION['field5']=array($line['page_title']);
break;
default:
$_SESSION['field5']=array();
break;
}
regards
Logged
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #185 on:
October 08, 2011, 10:11:55 AM »
Thanks again marmot, I appreciate your efforts trying to help me!
I mist say I'm a bit confused because you keep writing "site", where you surely must mean "page". Am I right? Maybe you're German and confuse "Seite" with "site"?
But that aside, forget about the extracting page title bit. It cannot be done I see now. The form options are of course set manually, and cannot be created dynamically from an array of page titles. So, that was wrong thinking of me.
I think it's all getting a bit too complex now. Really the only thing I need is the page ID of the referring page. But although it seems there is a constant REFERRER_ID (the search function and ShowMenu2 use it too), it seems that it cannot be used in snippets, like you can use PAGE_ID in snippets. Because if REFERRER_ID could be used, my initial idea could work:
Code:
if (REFERRER_ID==221) {
$_SESSION['field63']='MBA Customer Management';
}
So I tried using code you posted and thought this might work, but it doesn't. Since my PHP skills are very limited and I don't really understand coding, this code is probably complete nonsense to you
Code:
$ref = basename($_SERVER['HTTP_REFERER'],".php");
$query = "SELECT 'page_id' FROM '".TABLE_PREFIX."pages' WHERE 'link'='/".$ref."'";
$result = mysql_query($query);
$line = mysql_fetch_array($result);
$id = $line['page_id'];
if ($id==221) {
$_SESSION['field63']='MBA Customer Management';
}
Anyway, is there some way to use the referring page ID as a basis? Then I would be happy.
«
Last Edit: October 08, 2011, 10:15:06 AM by Argos
»
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #186 on:
October 08, 2011, 11:00:13 AM »
Hi,
Quote from: Argos on October 08, 2011, 10:11:55 AM
I mist say I'm a bit confused because you keep writing "site", where you surely must mean "page". Am I right? Maybe you're German and confuse "Seite" with "site"?
You guess completely right. Sorry for that confusion.
Quote
Really the only thing I need is the page ID of the referring page. But although it seems there is a constant REFERRER_ID (the search function and ShowMenu2 use it too), it seems that it cannot be used in snippets, like you can use PAGE_ID in snippets. Because if REFERRER_ID could be used, my initial idea could work:
Code:
if (REFERRER_ID==221) {
$_SESSION['field63']='MBA Customer Management';
}
Of course that would be fine. I looked up
http://www.websitebaker2.org/de/hilfe/entwicklerhandbuch/variablen-und-konstanten.php#anker2
and there is no constant like this. Read the help file of SM2 and you might find, that the constant has to be defined in your template. I don't really understand whats going on there an if this definition only can be used for search function and SM2.
Quote
So I tried using code you posted and thought this might work, but it doesn't.
Code:
$ref = basename($_SERVER['HTTP_REFERER'],".php");
$query = "SELECT 'page_id' FROM '".TABLE_PREFIX."pages' WHERE 'link'='/".$ref."'";
$result = mysql_query($query);
$line = mysql_fetch_array($result);
$id = $line['page_id'];
if ($id==221) {
$_SESSION['field63']='MBA Customer Management';
}
Anyway, is there some way to use the referring page ID as a basis? Then I would be happy.
Hmm, for me this should work. I would start some debugging by inserting some echo instructions: echo $id; echo $_SESSION['field63']; for example. I would say just a typo or carless mistake. Your concept should work.
regards
Logged
badknight
Security Team
Offline
Posts: 246
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #187 on:
October 08, 2011, 11:22:05 AM »
Quote from: marmot on October 08, 2011, 11:00:13 AM
I don't really understand whats going on there an if this definition only can be used for search function
The search function get the Referrer ID from the POST:
Code:
<form name="search" action="www.xyz.com/search/index.php" method="get">
<input type="hidden" name="referrer" value="PAGE_ID" />
search/index.php:
Code:
//Get the referrer page ID if it exists
if(isset($_REQUEST['referrer']) && is_numeric($_REQUEST['referrer']) && intval($_REQUEST['referrer']) > 0) {
define('REFERRER_ID', intval($_REQUEST['referrer']));
} else {
define('REFERRER_ID', 0);
}
A simple solution for the REFERRER:
put a code like:
Code:
$_SESSION['PAGE_REFERER'] = PAGE_ID;
at the end of the file WBDIR/index.php
so it look like this:
Code:
// end of wb-script
$_SESSION['PAGE_REFERER'] = PAGE_ID;
exit;
and now you can use $_SESSION['PAGE_REFERER'] in youre script
Logged
Ich würde gern die Welt verändern, doch Gott gibt mir den Quellcode nicht...
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #188 on:
October 09, 2011, 10:49:46 AM »
badknight, thanks for your reply. I tried it, but there are 2 problems:
1. the solution works fine with a simple echo command:
Code:
echo $_SESSION['PAGE_REFERER'];
but not with my code:
Code:
if ($_SESSION['PAGE_REFERER']==221) {
$_SESSION['field63']='MBA Customer Management';
}
It doesn't select the option.
2. the solution doesn't work at all when you use the module "404 Redirect" (see
http://www.websitebaker2.org/forum/index.php/topic,21145.0.html
) anywhere on your site. In that case even a simple echo command for some reason always shows the page ID of the module "404 Redirect", whatever page the referrer is.
«
Last Edit: October 09, 2011, 10:52:24 AM by Argos
»
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
badknight
Security Team
Offline
Posts: 246
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #189 on:
October 09, 2011, 11:35:00 AM »
i try it with WB 2.8.2 and the MPFORM
Code:
$module_version
= '1.0.1';
and it works fine:
index.php in the root dir of WB:
Line 157 (between: // end of wb-script and exit)
Code:
// end of wb-script
$_SESSION['PAGE_REFERER'] = PAGE_ID;
exit;
and in the Private.php of the mpform:
----------
i try it in the function "private_function_be
fore_new_form"
if($_SESSION['PAGE_REFERER'] == 2) {
echo "it works";
}
the session works fine!
Logged
Ich würde gern die Welt verändern, doch Gott gibt mir den Quellcode nicht...
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #190 on:
October 09, 2011, 03:27:27 PM »
Hi,
Quote from: Argos on October 09, 2011, 10:49:46 AM
1. the solution works fine with a simple echo command:
Code:
echo $_SESSION['PAGE_REFERER'];
but not with my code:
Code:
if ($_SESSION['PAGE_REFERER']==221) {
$_SESSION['field63']='MBA Customer Management';
}
It doesn't select the option.
I don't think the problem is how to get the id of the refering page. Up to now you got al least two ways of doing that. As I wrote before, I assume the problem is much easier and you should start some systematic debugging. So is the page_id in echo the right one? Just use
Code:
$_SESSION['field63']='MBA Customer Management';
without the if condition, does this select the option?
@badknight: Be sure I know what the lines of code mean (btw. the method is "GET" and not "POST") but at this moment I'm not aware what it is used for and it it's the same used in SM2 and why it is done this way. But thanks for your hint anyway.
regards
Logged
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #191 on:
October 11, 2011, 01:18:53 AM »
@badknight: your solution worked fine for echoing the referer ID, or echoing something else based on the referer ID, or even pre-filling a short or long text field in MPForm based on referer ID. But automatic form option choices (radio button, checkbox or selection menu) based on the referer ID didn't work at first. After I finally foudn out that you have to use "array" for those situations. And now it works!
So my simple test form with a selection menu, a short text field, and a long text field, works with this code:
Code:
if ($_SESSION['PAGE_REFERER']==57) {
$_SESSION['field2']=array('Option 3');
$_SESSION['field3']='Please type your name here...';
$_SESSION['field4']='Please type your message here...';
}
So now I can put all the if then situations in 1 code section or private.php file, without having to add code sections to all pages, and not havign to worry about changed page titles.
Thanks both marmot and badknight for your help!
«
Last Edit: October 11, 2011, 01:54:30 AM by Argos
»
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #192 on:
October 11, 2011, 05:10:00 PM »
There is one problem still though: this method is not compatible with the 404 Redirect module (and probably with regular htaccess redirects neither). Can this be fixed?
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #193 on:
October 12, 2011, 09:24:53 PM »
Hi,
Quote from: Argos on October 11, 2011, 01:18:53 AM
After I finally foudn out that you have to use "array" for those situations. And now it works!
LOL, this exactly what I told you before about reading answers. Look at my posts until
http://www.websitebaker2.org/forum/index.php/topic,13655.msg151992.html#msg151992
there always was the "array" in it but then somehow you lost ist. Ok, I must admit I didn't recognize this mistake either.
What about the code I posted here
http://www.websitebaker2.org/forum/index.php/topic,13655.msg151992.html#msg151992
. Does this have the problems with the redirect module also?
regards
Logged
Argos
Moderator
Offline
Posts: 2157
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #194 on:
October 13, 2011, 12:46:44 AM »
Quote from: marmot on October 12, 2011, 09:24:53 PM
Hi,
Quote from: Argos on October 11, 2011, 01:18:53 AM
After I finally foudn out that you have to use "array" for those situations. And now it works!
LOL, this exactly what I told you before about reading answers. Look at my posts until
http://www.websitebaker2.org/forum/index.php/topic,13655.msg151992.html#msg151992
there always was the "array" in it but then somehow you lost ist.
Well, not quite. I just didn't realize the badknight code needed it too. Remember, I'm no coder and I don't understand what array is or what it does and why it is needed. I just looked again at your posts and noticed there was array in your code, so I thougth i'd give that a try. And that worked
So, actually I found myself rather clever to add that LOL
Quote
What about the code I posted here
http://www.websitebaker2.org/forum/index.php/topic,13655.msg151992.html#msg151992
. Does this have the problems with the redirect module also?
No, that code doesn't work at all here, not even without the redirect stuff. Only your first pieces of code in the thread did work.
«
Last Edit: October 13, 2011, 01:13:21 AM by Argos
»
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marmot
Offline
Posts: 205
Re: Stable version of MPForm ( Multi Purpose Form)
«
Reply #195 on:
October 15, 2011, 08:46:24 AM »
Hi,
did you solve your problem now? I got the same issue with the PAGE_REFERER but after playing around a bit it worked and I can't find out what happened
.
If this is still a problem for you, maybe we can try the other option again.
regards
Logged
Pages:
1
...
6
7
[
8
]
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...