Reply To: Isaac Harned – Here for forms with javascript

  • Liz Larsen

    Member
    October 31, 2022 at 6:03 pm
    Points: 5,232
    Rank: UC2 Brainery Purple Belt UC2 Brainery Purple Belt Rank

    @isaac-harned

    So in the local code, the line:

    var tap = dropDownName.match(/\d{1,2}$/)

    Does this only store what is matched? I.e. it looks at NumberOfTaps1, and only stores the “1” since it matches the search for 1 or 2 digits at the end of the string?

    Yes, you got it. The tap variable stores the number of taps for that particular terminal. (I always hope that I’m using the correct terminology for your PDF)

    var dropDownName = event.target.name stores the name of the dropdown box

    var tap = dropDownName.match(/\d{1,2}$/) stores the digit on the end of the dropDownName, thereby effectively finding the layer it’s on.

    That tap variable is then passed to the global code, which turns the appropriate layers on or off.