无法在Joomla中获取PHP填充选择列表代码! BreezingForms工作 [英] Can't get PHP populate select list code in Joomla! BreezingForms to work

查看:69
本文介绍了无法在Joomla中获取PHP填充选择列表代码! BreezingForms工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用BreezingForms for Joomla开发人员主持的这个页面中的确切代码片段(简单版本的第1步)! CMS,仅修改为具有正确的表和字段名称,以及表单中选择列表的名称:http://crosstec.de/media/kunena/attachments/59203/BreezingFormsscriptdev.txt



我想在BreezingForms中做的就是填充一个选择列表,其中address字段为name,buildingID为value。我不需要步骤2,3等的脚本,因为我不需要填充其他表单字段。但是,此代码插入高级>表单选项>表格件>在表单框之前,选择列表甚至无法显示在带有表单的页面上,请参见此处:http://catondesigngroup.com/websites/joooid/select-test/view/form.html



表格字段标签选择列表在那里,但选择列表框无法显示。我没有看到为什么它不起作用的任何理由。这有什么不对?请帮忙!



注意:我省略了这两行代码,因为我不需要用户名或用户ID,但试图实现这些代码行确实有用:



$ user =& JFactory :: getUser(); //通过JFactory获取用户

$ userid = $ user-> id; //你可能需要为此使用不同的值或者没有



========= START CODE ========= ====



I''m using the exact code snippet (Step 1 of the Simple Version) from this page hosted by the developers of BreezingForms for Joomla! CMS, modified only to have the correct table and field names, and the name of the select list in the form: http://crosstec.de/media/kunena/attachments/59203/BreezingFormsscriptdev.txt

All I want to do in BreezingForms is to populate a select list with the "address" field as name and "buildingID" as value. I don''t need the scripts in Step 2, 3, etc. because I don''t need to populate other form fields. However with this code inserted in Advanced > Form Options > Form Pieces > Before Form box, the select list fails to even show up on the page with the form, see here: http://catondesigngroup.com/websites/joooid/select-test/view/form.html

The form field label "Select List" is there, but the select list box fails to appear. I don''t see any reason why it doesn''t work. What''s wrong here? Please help!

Note: I omitted these two lines of code because I don''t need usernames or user ID''s, however trying to implement these lines of code does help any:

$user = &JFactory::getUser(); // get the user via JFactory
$userid = $user->id; // you may need to use a different value for this or none

=========START CODE=============

this->execPieceByName(''ff_InitLib'');

$rows = ff_select("SELECT buildingID, address
FROM ty43k_building_inspection");
$listdata = "0;Please make a selection;0\n";
for ($i = 0; $i < count($rows); $i++) {
$listdata .= "0;{$rows[$i]->address};{$rows[$i]->buildingID}\n";
}

ff_setSelectList(''select1'', $listdata);

function ff_setSelectList($name, $value) {
global $ff_processor;
for ($r = 0; $r < $ff_processor->rowcount; $r++) {
$row =& $ff_processor->rows[$r];
if ($row->name==$name)
$row->data2 = $value;
unset($row);
} // for

} // ff_setSelectList



======== END CODE = ========



[edit]已添加代码块[/ edit]

推荐答案

user =& JFactory :: getUser(); //通过JFactory获取用户
user = &JFactory::getUser(); // get the user via JFactory


userid =


user-> id; //你可能需要为此使用不同的值或者没有



========= START CODE ========= ====



user->id; // you may need to use a different value for this or none

=========START CODE=============

this->execPieceByName(''ff_InitLib'');


这篇关于无法在Joomla中获取PHP填充选择列表代码! BreezingForms工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆