It appears form builder's
function fb_generate_form($settings) does not check the resource type yet, and serves all resources as css.
See \modules\form_builder\global\code\generator.php , beginning line 256.
This bug also appears in the bug tracker:
Issue #365 ยป JavaScript Form Builder Resource applied as CSS Sheet, when specified as JavaScript type
For the time being, the best option is likely to upload a js file elsewhere, and hard code the script link into your template. That won't achieve what css.php does, as far as access control (It looks like it won't serve resources for a private form unless you're logged in, which is nice to know, if I find a reason for private forms).
Alternately, you can live dangerously, and do this for the current version:
Core 2.2.6
Formbuilder 1.0.7
Copy File:
\modules\form_builder\global\form_resources\css.php
to
\modules\form_builder\global\form_resources\js.php
In the new copy, js.php,
Change line 10:
PHP Code:
header("Content-Type: text/css");
to:
PHP Code:
header("Content-Type: text/javascript");
Make a backup copy of file:
\modules\form_builder\global\code\generator.php
Replace line 260:
PHP Code:
$link = "<link type=\"text/css\" rel=\"stylesheet\" href=\"$g_root_url/modules/form_builder/global/form_resources/css.php?resource_id=$resource_id&nocache=$now{$query_str}\">";
with:
PHP Code:
$resource_type = $resource_info["resource_type"];
if($resource_type == 'js') {
$link = "<script type=\"text/javascript\" src=\"$g_root_url/modules/form_builder/global/form_resources/js.php?resource_id=$resource_id&nocache=$now{$query_str}\"></script>";
} else {
$link = "<link type=\"text/css\" rel=\"stylesheet\" href=\"$g_root_url/modules/form_builder/global/form_resources/css.php?resource_id=$resource_id&nocache=$now{$query_str}\">";
}
No warranty provided that this is fit for any purpose. It will likely break if form builder is updated, and the bug is not fixed in the update. These instructions may not work for, or may break future or past versions.