4 Replies Latest reply on Jul 1, 2010 11:39 AM by resdesign

    Simple (?) JS question: use a variable in place of a string

      I'm working on a script that will take a selection and add it to the index multiple times, as a level 2 topic under different level 1 topics. Sometimes, it would be nice to edit the selection before creating the page references.

      I want to use a dialog box, which would have checkboxes for the level 1 entries, and an edit box that shows what will be the level 2 part of each reference. The edit box should start containing what was selected when the script was run.

      The ComplexUI.jsx sample script contains this on line 17:

      var myTextEditField = textEditboxes.add({editContents:"Hello World!", minWidth:180});

      I would like to use the variable into which I captured the selection in place of "Hello World!" Obviously, I'd use more than the one line, but I just pasted in the one that seems most relevant.

      I can't figure out how to do it. When I try, I get an error stating that a string was expected, but text was encountered.

      I'm sure this is truly one of the more basic JavaScript skills, but it is one I lack. Can anyone enlighten me?