Creating an array of objects with variable properties

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    Creating an array of objects with variable properties

    I am getting a little hung up on the syntax I need to populate a hash table within an hash table of object. (not even sure if I stated that correctly)

    Here is the structure I am trying to set up

    GroupName
    DeptName
    Code

    There can only be one unique GroupName

    There can be multiple "DeptName" and within "DeptName" there can be a
    variable number of Codes. For example"

    ShoreWoodJobs (GroupName)
    2330 (DeptName)
    30 (Code)
    60
    2360
    30
    70
    80

    The process start when the user completes the form, one entry field (where they create the group name) and two
    list boxes.

    The second select box is set to multiple selects.

    The first select box is not multiple but I intend for the user to be able to cycle
    around and add a 2nd, 3rd.... DeptName each with their own code.

    What I am trying to avoid is having a standard array elem[1], elem[2], ....

    Ultimately, since this will be a data stored in a fairly small table, when the user calls up the form I wish to create this array structure for validation on the client side i.e verify that no duplicate group names are created or offer the user the choice that their current entry will replace the existing stored values.

    Any suggested code would be appreciated.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You may find this useful. You could also look into JSON.

    Comment

    Working...