Starting a new thread here! This code from a javascript, trashes two fields when used as part of the header in the preview_form. Can someone PLEASE help me modify it so that it:
either -- selects the values sent via the submitted add form
or -- writes the values to the database that were submitted in the add form and NOT overwrite them unless new values have been specifically chosen (don't overwrite with null values!)
Here's the pertinent Javascript code, I don't have a clue how to change it to achieve what I'm looking for though, so any help would be greatly appreciated. (I know the script is working other than this overwriting submitted values on the preivew form only though).
new Array(
new Array("Please Describe below", "Please Describe below")
)
);
function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
//for (i = selectCtrl.options.length; i >= 0; i--) {
//selectCtrl.options = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[0]);
if (itemArray[1] != null) {
selectCtrl.options[j].value = itemArray[1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
}
}
function init(frm) {
var combo = frm.Select_Box;
var combo2 = frm.Category;
frm.category.value = combo.options[combo.selectedIndex].value;
frm.occupancytype.value = combo2.options[combo2.selectedIndex].value;
}
THANKS!
Lynette
Hollister, Ca
either -- selects the values sent via the submitted add form
or -- writes the values to the database that were submitted in the add form and NOT overwrite them unless new values have been specifically chosen (don't overwrite with null values!)
Here's the pertinent Javascript code, I don't have a clue how to change it to achieve what I'm looking for though, so any help would be greatly appreciated. (I know the script is working other than this overwriting submitted values on the preivew form only though).
new Array(
new Array("Please Describe below", "Please Describe below")
)
);
function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
//for (i = selectCtrl.options.length; i >= 0; i--) {
//selectCtrl.options = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[0]);
if (itemArray[1] != null) {
selectCtrl.options[j].value = itemArray[1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
}
}
function init(frm) {
var combo = frm.Select_Box;
var combo2 = frm.Category;
frm.category.value = combo.options[combo.selectedIndex].value;
frm.occupancytype.value = combo2.options[combo2.selectedIndex].value;
}
THANKS!
Lynette
Hollister, Ca

