FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Global Pre-Parse?
#1
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?
Reply
#2
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?
Reply
#3
Smile 
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...
Reply
#4
umm interesting will have a go my self

thanks for this mate
Reply
#5
@marcat:

Thanks! I arrived at the same conclusion and your fix works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)