I promise, I've researched this issue and I haven't had much luck finding a usable answer.
I was actually happy with how useful chrisconverse's lesson "Changing another field with Combo Box Selection" was at /print/636; it was exactly what I needed! I was mindful of changing out the names of my fields to his and even carefully read through his directions, but somehow, I'm afraid I'm just not getting it. In my script below, rather than pre-populating 3 fields, I'm only changing 1 (note: the script is half written because there was a lot of typing left to do and I was afraid of just what happened: the script wasn't accepted!). I get a repeated warning about missing a : at Line 4.
Another issue I seem to have is understanding the spacing in the scripts that I see on the various forums and webpages or some of the things I've attempted to write. Is that a space in between the slashes? Are there actually carriage returns or tabs (in the version on chrisconverse's tutorial)? This might also be what trips me up. I've seen Thom P's tips on c/p scripting, but I need a better understanding of that.
BTW, scripting is not a key job function for me, but I've found it useful to learn and would love to introduce more such documents and forms to my 'company'
Thanks in advance,
Page
// Place all pre-population data into a single data structure
var JobData = { Toll Collector:{ Func2: "MUST be able to lift 35 pounds. Standing 6 or more hours per day. Pushing and pulling, twisting, reaching and bending. May involve stair climbing." },
Lane and Plaza Supervisor:{ Func2: "MUST be able to lift 65 pounds. Standing 6 or more hours per day. Pushing and pulling, twisting, reaching and bending. May involve climbing stairs." } };
function SetFieldValues(cJobTitle)
{
// Populate fields with values from the Job Data Object
this.getField("JobFunc2").value = JobData[cJobData].Func2;
}
" - use as a quote within a quoted string
\ - insert the escape character
n - new line
r - line return
t - tab
When creating a data object, the element names can not have spaces within the name unless the name is a quoted character string.
George Kaiser