本文整理匯總了PHP中FormHelper::selectbox方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormHelper::selectbox方法的具體用法?PHP FormHelper::selectbox怎麽用?PHP FormHelper::selectbox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FormHelper
的用法示例。
在下文中一共展示了FormHelper::selectbox方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render
public function render()
{
$value = 0;
$value_id = 0;
$aDataSource = $this->getDataSource();
if ($this->getIsTree()) {
$aDataSource[2]['Criteria']['ParentId'] = 0;
}
$oDataProvider = new DataProvider($aDataSource);
$oData = $oDataProvider->execute();
//echo '<pre>', print_r($oData, true), '</pre>'; die();
$aResult = array();
$aResult[] = array('Name' => $this->getDefaultText(), 'Value' => $this->getDefaultValue());
if ($this->getDefault()) {
$aRs = array();
if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
$value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
}
}
if ($this->getValue()) {
$value_id = $this->getValue();
}
$aResult = $this->createRow($oData, $aResult);
if ($this->getOnChange()) {
$tmpChange = $this->getOnChange();
echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox ajax_response_list', 'data-field' => $tmpChange[0], 'data-id' => $this->getValue(), 'id' => 'field_' . $this->getAlias()));
//$.post('/structure/page_backend/typeParams', {Id: $this->getValue()}, function (data) { /* response */ });
} else {
echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox', 'id' => 'field_' . $this->getAlias()));
}
}
示例2: render
public function render()
{
$value = 0;
$value_id = 0;
$aDataSource = $this->getDataSource();
$aDataSource[2]['Criteria']['ParentId'] = 0;
$oDataProvider = new DataProvider($aDataSource);
$oData = $oDataProvider->execute();
//echo '<pre>', print_r($oData, true), '</pre>'; die();
$aResult = array();
$aResult[] = array('Name' => $this->getDefaultText(), 'Value' => $this->getDefaultValue());
if ($this->getDefault()) {
$aRs = array();
if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
$value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
}
}
if ($this->getValue()) {
$value_id = $this->getValue();
}
if ($oData->count() > 0) {
$aResult = $this->getChilds($oData, 1, $aResult);
}
echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox', 'id' => 'field_' . $this->getAlias()));
}