Use the Syntax Editor

  1. Type Client Script in the Application Navigator's filter field.
  2. Select the System Definition > Client Scripts module.
  3. Select the New button
  4. Enter Lab 1.1 Using the Syntax Editor in the Name field.
  5. De-select the Active checkbox to prevent the script from running
  6. In the Script field, enter the following text:

    Code to test the Syntax Editor features
    - Syntax coloring
    - Special gharacter highlighting
    - Layout
    - And more
    
  7. Convert the text to a comment

    1. Select all of the text
    2. Select the toggle comment button on the syntax editor toolbar
  8. In the Script field, below the commented lines, enter the following script exactly as it appears here. As you enter the script, note the syntax coloring, special character highlighting, auto-indentation and the automatic creation of closing braces and quotes.
var myString = "Hello World";
var myNum = 32;
var myArray = ["Smartphone", "Tablet", "Laptop"];

var myObj = {
    property1: "first",
    property2: "second",
    property3: "Third"
};

for (var i=0; i<myArray.length; i++){
    alert("The current value of myArray is: " + myArray[i]);
}

FURTHER INSTRUCTIONS

  1. Save the script by selecting the Save button on the Syntax Editor toolbar
  2. Turn off syntax highlighting by selecting the Toggle Syntax Editor button. What differences do you notice in the Syntax Editor?
  3. Use the Replace feature to change the number 2 in myObj.property2 to myObj.propertyTwo. ->to
  4. Select the Replace button
  5. Type 2 in the Replace field then press <enter> on your keyboard
  6. Type Two in the With field then press <enter> on your keyboard
  7. Select No when prompted to replace the 2 in 32
  8. Select Yes when prompted to replace number 2 in property2 with the word Two.
  9. Use the Replace All feature to change value for myObj.property3 form Third to third.
  10. Select Replace All button
  11. Type Third in the Replace field then press <enter> on your keyboard
  12. Type third in the With field then press <enter> on your keyboard
  13. Select Yes when prompted to replace Third with third
  14. Select Update button on the Header bar to save the script and exit the form

results matching ""

    No results matching ""