2012-01-06 30 views

回答

0

假设你有一个像mysql一样的数据库。

  • 创建表状态(STATE_ID,STATE_NAME,state_abbr)
  • 从状态表中提取状态(写一个函数来获取状态),使用PHP脚本在您的选择框的选项
  • 迭代 例如:

     <select name="state"> 
          <?php 
          *// At this point you should have a recordset $rsstate which fetches all the records from the state table* 
          while($rowState = mysql_fetch_array($rsState)){?> 
          <option value=<?php echo $rowState["state_abbr"]?>><?php echo $rowState["state_name"]; ?></option> 
          <?php }?> 
         </select> 
    
1

假设你有一个像MySQL的一个DATABSE。

  • 创建表statestate_idstate_namestate_abbr
  • state表中提取状态(写一个函数来获取状态),使用PHP脚本在您的选择框的选项
  • 迭代,例如:

    <select name="state"> 
    <?php 
    // At this point you should have a recordset $rsstate which fetches all the records from the state table 
    while($rowState = mysql_fetch_array($rsState)) { ?> 
        <option value=<?php echo $rowState["state_abbr"] ?>><?php echo $rowState["state_name"]; ?></option> 
    <?php } ?> 
    </select> 
    
+0

感谢您的回复......其实我已经在核心PHP中完成了这种工作,并且我知道如何完成,但是在Vtiger CRM中这是非常复杂的问题,在这种情况下我们必须更改文件它适合于tpl文件。所以这是我的问题.. – 2012-01-07 04:41:23

0

只要到管理面板并添加一个选项列表。它非常简单。

1

你可以使用vtlib库。

这是我们如何使用vtlib

<?php 
$Vtiger_Utils_Log = true; 
include_once('vtlib/Vtiger/Menu.php'); 
include_once('vtlib/Vtiger/Module.php'); 
$module = Vtiger_Module::getInstance('Accounts'); 
$infoBlock = Vtiger_Block::getInstance('LBL_ACCOUNT_INFORMATION', $module); 
$stateField = Vtiger_Field::getInstance('state', $module); 
if (!$stateField) { 
    $stateField = new Vtiger_Field(); 
    $stateField->name = 'state'; 
    $stateField->label = 'State'; 
    $stateField->columntype = 'VARCHAR(100)'; 
    $stateField->uitype = 16; 
    $stateField->typeofdata = 'V~O'; 
    $infoBlock->addField($stateField); 
    $stateField->setPicklistValues(array('Kerala', 'Karnataka', 'Maharashtra', 'Manipur')); 

} 

添加状态列表的其余部分是阵列中账户模块中创建一个状态名下拉框。

希望这会有所帮助。