I need to write a script that cycles through a form to change some values based on one of several templates. I only want to change a given field if the current value is "Unknown".
I'm guessing I will need an array of all the different field ids, and separate arrays for each template with what fields to change, and what they should be changed to. Other than that I'm not sure how to fit them together, and I'm not too familiar with JavaScript array key/value pairs.
var allFields=new Array("id1","id2","id3","id4","id5","id6","id7","id8","id9","id10");
var template1=new Array("id1":"Yes","id4":"No","id5":"Maybe");
var template2=new Array("id2":"Always","id4":"Yes","id9":"Yes","id10":"Never");
var template3=new Array("id5":"Okay");
var template5=new Array("id7":"No","id8":"You Bet");
function useTemplate(templateName){
? ? ?
}