Variable form select value mods

This commit is contained in:
Nate Jones 2014-04-27 08:55:39 +00:00
parent 89bea49f38
commit 53c7c9957e
2 changed files with 20 additions and 25 deletions

View File

@ -194,10 +194,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
if ($action == "add") {
echo "<td width='30%' align='left'nowrap><b>".$text['header-var_add']."</b></td>\n";
echo "<td width='30%' align='left'nowrap><b>".$text['header-variable_add']."</b><br><br></td>\n";
}
if ($action == "update") {
echo "<td width='30%' align='left' nowrap><b>".$text['header-var_edit']."</b></td>\n";
echo "<td width='30%' align='left' nowrap><b>".$text['header-variable_edit']."</b><br><br></td>\n";
}
echo "<td width='70%' align='right'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='vars.php'\" value='".$text['button-back']."'>";
@ -245,7 +245,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='var_enabled'>\n";
echo " <option value=''></option>\n";
if ($var_enabled == "true") {
echo " <option value='true' SELECTED >".$text['option-true']."</option>\n";
}
@ -269,27 +268,23 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-order'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='var_order' class='formfld'>\n";
if (strlen(htmlspecialchars($var_order ))> 0) {
echo " <option selected='yes' value='".htmlspecialchars($var_order )."'>".htmlspecialchars($var_order )."</option>\n";
}
echo " <select name='var_order' class='formfld'>\n";
$i=0;
while($i<=999) {
if (strlen($i) == 1) {
echo " <option value='00$i'>00$i</option>\n";
}
if (strlen($i) == 2) {
echo " <option value='0$i'>0$i</option>\n";
}
if (strlen($i) == 3) {
echo " <option value='$i'>$i</option>\n";
}
$i++;
$selected = ($var_order == $i) ? "selected" : null;
if (strlen($i) == 1) {
echo " <option value='00$i' ".$selected.">00$i</option>\n";
}
if (strlen($i) == 2) {
echo " <option value='0$i' ".$selected.">0$i</option>\n";
}
if (strlen($i) == 3) {
echo " <option value='$i' ".$selected.">$i</option>\n";
}
$i++;
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo " </select>\n";
echo " <br />\n";
echo "</td>\n";
echo "</tr>\n";

View File

@ -220,11 +220,11 @@
//html select other : build a select box from distinct items in db with option for other
global $domain_uuid;
$html = "<table width='50%' border='0' cellpadding='1' cellspacing='0'>\n";
$html = "<table border='0' cellpadding='1' cellspacing='0'>\n";
$html .= "<tr>\n";
$html .= "<td id=\"cell".$field_name."1\" width='100%'>\n";
$html .= "<td id=\"cell".$field_name."1\">\n";
$html .= "\n";
$html .= "<select id=\"".$field_name."\" name=\"".$field_name."\" class='formfld' style='width: 100%;' onchange=\"if (document.getElementById('".$field_name."').value == 'Other') { /*enabled*/ document.getElementById('".$field_name."_other').style.width='95%'; document.getElementById('cell".$field_name."2').width='70%'; document.getElementById('cell".$field_name."1').width='30%'; document.getElementById('".$field_name."_other').disabled = false; document.getElementById('".$field_name."_other').className='txt'; document.getElementById('".$field_name."_other').focus(); } else { /*disabled*/ document.getElementById('".$field_name."_other').value = ''; document.getElementById('cell".$field_name."1').width='95%'; document.getElementById('cell".$field_name."2').width='5%'; document.getElementById('".$field_name."_other').disabled = true; document.getElementById('".$field_name."_other').className='frmdisabled' } \">\n";
$html .= "<select id=\"".$field_name."\" name=\"".$field_name."\" class='formfld' onchange=\"if (document.getElementById('".$field_name."').value == 'Other') { /*enabled*/ document.getElementById('".$field_name."_other').style.display=''; document.getElementById('".$field_name."_other').className='formfld'; document.getElementById('".$field_name."_other').focus(); } else { /*disabled*/ document.getElementById('".$field_name."_other').value = ''; document.getElementById('".$field_name."_other').style.display='none'; } \">\n";
$html .= "<option value=''></option>\n";
$sql = "SELECT distinct($field_name) as $field_name FROM $table_name $sql_where_optional ";
@ -251,7 +251,7 @@
$html .= "</select>\n";
$html .= "</td>\n";
$html .= "<td id=\"cell".$field_name."2\" width='5'>\n";
$html .= "<input id=\"".$field_name."_other\" name=\"".$field_name."_other\" value='' style='width: 5%;' disabled onload='document.getElementById('".$field_name."_other').disabled = true;' type='text' class='frmdisabled'>\n";
$html .= "<input id=\"".$field_name."_other\" name=\"".$field_name."_other\" value='' type='text' class='formfld' style='display: none;'>\n";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>";