本文整理匯總了PHP中XoopsFormRadio::setExtra方法的典型用法代碼示例。如果您正苦於以下問題:PHP XoopsFormRadio::setExtra方法的具體用法?PHP XoopsFormRadio::setExtra怎麽用?PHP XoopsFormRadio::setExtra使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XoopsFormRadio
的用法示例。
在下文中一共展示了XoopsFormRadio::setExtra方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: XoopsFormCheckBox
$form_physical->setExtra('class="valinp"');
$form_physical->addOption("met", _LANG_WLA_CHECK_MET);
$form_xfn->addElement($form_physical);
$form_professional = new XoopsFormCheckBox(_LANG_WLA_SUB_PROFESSIONAL . " : ", "professional", $professional);
$form_professional->setExtra('class="valinp"');
$form_professional->addOption("co-worker", _LANG_WLA_CHECK_WORKER);
$form_professional->addOption("colleague", _LANG_WLA_CHECK_COLL);
$form_xfn->addElement($form_professional);
$form_geographical = new XoopsFormRadio(_LANG_WLA_SUB_GEOGRAPH . " : ", "geographical", $geographical);
$form_geographical->setExtra('class="valinp"');
$form_geographical->addOption("co-resident", _LANG_WLA_CHECK_RESI);
$form_geographical->addOption("neighbor", _LANG_WLA_CHECK_NEIG);
$form_geographical->addOption("", _LANG_WLA_CHECK_NONE);
$form_xfn->addElement($form_geographical);
$form_family = new XoopsFormRadio(_LANG_WLA_SUB_FAMILY . " : ", "family", $family);
$form_family->setExtra('class="valinp"');
$form_family->addOption("child", _LANG_WLA_CHECK_CHILD);
$form_family->addOption("parent", _LANG_WLA_CHECK_PARENT);
$form_family->addOption("sibling", _LANG_WLA_CHECK_SIBLING);
$form_family->addOption("spouse", _LANG_WLA_CHECK_SPOUSE);
$form_family->addOption("", _LANG_WLA_CHECK_NONE);
$form_xfn->addElement($form_family);
$form_romantic = new XoopsFormCheckBox(_LANG_WLA_SUB_ROMANTIC . " : ", "romantic", $romantic);
$form_romantic->setExtra('class="valinp"');
$form_romantic->addOption("muse", _LANG_WLA_CHECK_MUSE);
$form_romantic->addOption("crush", _LANG_WLA_CHECK_CRUSH);
$form_romantic->addOption("date", _LANG_WLA_CHECK_DATE);
$form_romantic->addOption("sweetheart", _LANG_WLA_CHECK_HEART);
$form_xfn->addElement($form_romantic);
$form->addElement($form_xfn);
$form->addElement(new XoopsFormTextArea(_LANG_WLA_SUB_NOTE, "link_notes", $link_notes, 10, 60));
示例2: constructElement
//.........這裏部分代碼省略.........
$entryData = $this->formulize_getCachedEntryData($id_form, $entry);
$creation_datetime = display($entryData, "creation_datetime");
$evalResult = eval($ele_value[0]);
if ($evalResult === false) {
$ele_value[0] = _formulize_ERROR_IN_LEFTRIGHT;
} else {
$ele_value[0] = $value;
// value is supposed to be the thing set in the eval'd code
}
}
$ele_value[0] = $this->formulize_replaceCurlyBracketVariables($ele_value[0], $entry, $id_form);
$form_ele = $ele_value;
// an array, item 0 is the contents of the break, item 1 is the class of the table cell (for when the form is table rendered)
break;
case 'text':
$ele_value[2] = stripslashes($ele_value[2]);
// $ele_value[2] = $myts->displayTarea($ele_value[2]); // commented by jwe 12/14/04 so that info displayed for viewing in a form box does not contain HTML formatting
$ele_value[2] = getTextboxDefault($ele_value[2], $id_form, $entry);
//if placeholder value is set
if ($ele_value[11]) {
$placeholder = $ele_value[2];
$ele_value[2] = "";
}
if (!strstr(getCurrentURL(), "printview.php")) {
// nmc 2007.03.24 - added
$form_ele = new XoopsFormText($ele_caption, $form_ele_id, $ele_value[0], $ele_value[1], $ele_value[2]);
} else {
// nmc 2007.03.24 - added
$form_ele = new XoopsFormLabel($ele_caption, formulize_numberFormat($ele_value[2], $this->_ele->getVar('ele_handle')));
// nmc 2007.03.24 - added
}
//if placeholder value is set
if ($ele_value[11]) {
$form_ele->setExtra("placeholder='" . $placeholder . "'");
}
//if numbers-only option is set
if ($ele_value[3]) {
$form_ele->setExtra("class='numbers-only-textbox'");
}
// if required unique option is set, create validation javascript that will ask the database if the value is unique or not
if ($ele_value[9]) {
$eltname = $form_ele_id;
$eltcaption = $ele_caption;
$eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
$eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
$eltmsgUnique = empty($eltcaption) ? sprintf(_formulize_REQUIRED_UNIQUE, $eltname) : sprintf(_formulize_REQUIRED_UNIQUE, $eltcaption);
if ($this->_ele->getVar('ele_req')) {
// need to manually handle required setting, since only one validation routine can run for an element, so we need to include required checking in this unique checking routine, if the user selected required too
$form_ele->customValidationCode[] = "\nif ( myform.{$eltname}.value == '' ) {\n";
$form_ele->customValidationCode[] = "window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n";
$form_ele->customValidationCode[] = "}\n";
}
$form_ele->customValidationCode[] = "if(formulize_xhr_returned_check_for_unique_value != 'notreturned') {\n";
// a value has already been returned from xhr, so let's check that out...
$form_ele->customValidationCode[] = "if(formulize_xhr_returned_check_for_unique_value != 'valuenotfound') {\n";
// request has come back, form has been resubmitted, but the check turned up postive, ie: value is not unique, so we have to halt submission , and reset the check for unique flag so we can check again when the user has typed again and is ready to submit
$form_ele->customValidationCode[] = "window.alert(\"{$eltmsgUnique}\");\n";
$form_ele->customValidationCode[] = "formulize_xhr_returned_check_for_unique_value = 'notreturned'\n";
$form_ele->customValidationCode[] = "myform.{$eltname}.focus();\n return false;\n";
$form_ele->customValidationCode[] = "}\n";
$form_ele->customValidationCode[] = "} else {\n";
// do not submit the form, just send off the request, which will trigger a resubmission after setting the returned flag above to true so that we won't send again on resubmission
$form_ele->customValidationCode[] = "\nvar formulize_xhr_params = []\n";
$form_ele->customValidationCode[] = "formulize_xhr_params[0] = myform.{$eltname}.value;\n";
$form_ele->customValidationCode[] = "formulize_xhr_params[1] = " . $this->_ele->getVar('ele_id') . ";\n";
$xhr_entry_to_send = is_numeric($entry) ? $entry : 0;
示例3: render
function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id)
{
global $myts;
$myts =& MyTextSanitizer::getInstance();
$renderer =& new formulizeElementRenderer();
$ele_desc = $element->getVar('ele_desc', "f");
if (strstr($markupName, "de_")) {
// display element uses a slightly different element name so it can be distinguished on subsequent page load from regular elements...THIS IS NOT TRUE/NECESSARY ANYMORE SINCE FORMULIZE 3, WHERE ALL ELEMENTS ARE DISPLAY ELEMENTS
$true_ele_id = str_replace("de_" . $element->getVar('id_form') . "_" . $entry_id . "_", "", $markupName);
} else {
$true_ele_id = str_replace("ele_", "", $markupName);
}
$selected = '';
$disabledHiddenValue = "";
$options = array();
$opt_count = 1;
while ($i = each($ele_value)) {
$options[$opt_count] = constant($i['key']);
$options[$opt_count] = $myts->stripSlashesGPC($options[$opt_count]);
if ($i['value'] > 0) {
$selected = $opt_count;
}
$opt_count++;
}
if ($element->getVar('ele_delim') != "") {
$delimSetting = $element->getVar('ele_delim');
}
$delimSetting =& $myts->undoHtmlSpecialChars($delimSetting);
if ($delimSetting == "br") {
$delimSetting = "<br />";
}
$hiddenOutOfRangeValuesToWrite = array();
switch ($delimSetting) {
case 'space':
$form_ele1 = new XoopsFormRadio('', $markupName, $selected);
$counter = 0;
while ($o = each($options)) {
$o = formulize_swapUIText($o, $element->getVar('ele_uitext'));
$other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter);
if ($other != false) {
$form_ele1->addOption($o['key'], _formulize_OPT_OTHER . $other);
if ($o['key'] == $selected) {
$disabledOutputText = _formulize_OPT_OTHER . $other;
}
} else {
$o['value'] = get_magic_quotes_gpc() ? stripslashes($o['value']) : $o['value'];
$form_ele1->addOption($o['key'], $o['value']);
if ($o['key'] == $selected) {
$disabledOutputText = $o['value'];
}
if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
$hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
// if this is an out of range value, grab the actual value so we can stick it in a hidden element later
}
}
$counter++;
}
$form_ele1->setExtra("onchange=\"javascript:formulizechanged=1;\"");
break;
default:
$form_ele1 = new XoopsFormElementTray('', $delimSetting);
$counter = 0;
while ($o = each($options)) {
$o = formulize_swapUIText($o, $element->getVar('ele_uitext'));
$t = new XoopsFormRadio('', $markupName, $selected);
$other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter);
if ($other != false) {
$t->addOption($o['key'], _formulize_OPT_OTHER . $other);
if ($o['key'] == $selected) {
$disabledOutputText = _formulize_OPT_OTHER . $other;
}
} else {
$o['value'] = get_magic_quotes_gpc() ? stripslashes($o['value']) : $o['value'];
$t->addOption($o['key'], $o['value']);
if ($o['key'] == $selected) {
$disabledOutputText = $o['value'];
}
if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
$hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
// if this is an out of range value, grab the actual value so we can stick it in a hidden element later
}
}
$t->setExtra("onchange=\"javascript:formulizechanged=1;\"");
$form_ele1->addElement($t);
unset($t);
$counter++;
}
break;
}
$renderedHoorvs = "";
if (count($hiddenOutOfRangeValuesToWrite) > 0) {
foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
$thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
$renderedHoorvs .= $thisHoorv->render() . "\n";
unset($thisHoorv);
}
}
if ($isDisabled) {
$disabledHiddenValue = "<input type=hidden name=\"" . $markupName . "\" value=\"{$selected}\">\n";
$renderedElement = $disabledOutputText;
//.........這裏部分代碼省略.........