Posts: 25
Threads: 6
Joined: Mar 2010
Reputation:
0
I have installed and am using the Pre-Parse module and it works well on a per form basis. However, I would like to implement a Pre-Parse script globally so that any form posted to my instance of FT has to pass through a single pre-parse script first and then any other pre-parse script that may be defined for that particular form.
What are my options for doing this?
Posts: 25
Threads: 6
Joined: Mar 2010
Reputation:
0
Did a bit of poking around an found the smarty function that builds the select list for which form the pre-parse script is for. That file is /global/smarty/plugins/function.forms_dropdown.php
The add.tpl, edit.tpl and index.tpl functions call this function to build the select list.
In these files the function itself is called with this parameter: is_multiple=true.
However, within the function it appears that this option is tested for true or false, but never implemented? Is there a reason why multiple="multiple" shouldn't be set for this select list in the pre-parser module?
The comment says "// for multiple-select dropdowns" but I can not see where that html attribute ever gets set?
Posts: 25
Threads: 6
Joined: Mar 2010
Reputation:
0
Aug 8th, 2012, 12:10 PM
I decided to take matters into my own hands to solve this issue and as it turns out, was fairly simple to accomplish. Because there was already code in /global/smarty/plugins/function.forms_dropdown.php setting a boolean for is_multiple I decided to take the path of least resistance and simply add the missing parameter the select list rendered on the pre-parser page was missing.
Here's the 1 line of code I added to the forms_dropdown function:
if ($is_multiple){ $attribute_str = $attribute_str . " multiple=\"multiple\""; }
This code was added just before this line:
$html = "<select $attribute_str>" . join("\n", $options) . "</select>";
So, I am just using the existing $is_multiple to decide whether the function should add the multiple="multiple" parameter to the select list. I believe this was the intended purpose of that boolean variable in the first place and Ben just probably forgot to add that little bit of code to actually set the parameter?
What ever the case, I can now associate as many forms as I want with a single pre-parse script, which accomplishes my goal of being able to assign a single pre-parse script globally...
Posts: 9
Threads: 3
Joined: Nov 2011
Reputation:
0
umm interesting will have a go my self
thanks for this mate
Posts: 15
Threads: 8
Joined: Jan 2011
Reputation:
0
Aug 4th, 2014, 6:59 AM
(This post was last modified: Aug 4th, 2014, 6:59 AM by russellfeeed.)
@marcat:
Thanks! I arrived at the same conclusion and your fix works.