Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default asp array

    I have a recordset value that is within a Do While Loop: <input name='fieldA'
    type='hidden' id='fieldA'
    value='<%=(rsAllocation.Fields.Item('ABR_DETLS_ID' ).Value)%>'> Every iteration
    of the loop holds another value. So, if the loop executed 5 times, then I have
    5 hidden fields with different values from the resultset. I want to capture
    the all the values into an array and then pass the array as an argument into a
    javascript function. I've had no difficulty passing in arguments that hold one
    value, but I'm not sure how to handle multiple values? I have a variable that
    I set as the counter for the Do While loop, so the loop counter variable holds
    the number of loops that were executed. Creating my array as follows, would
    this hold all the hidden field values from the resultset: Dim
    myArray(loopCounter) Dim i For i = 0 to loopCounter myArray(i) =
    rsAllocation.Fields.Item('ABR_DETLS_ID').Value Next then I want to pass in the
    array as an argument to a javascript function: onClick='return
    CheckForm='<%=myArray()%>' Should the array then hold the hidden field values
    in a one dimensional comma delimited list? I can then split the values out
    from the list and then use them in the function? Thanks, -D-

    -D- Guest

  2. Similar Questions and Discussions

    1. Converting an XML Array to a multi-level array
      I have an array assigned to a data grid such as: private var myIngredients:Array = new Array( <item ln1="Plain" sn="plain" ln2="(3 cups)...
    2. [newbie]saving and reading array of associative array
      i'm looking for examples of saving to file and reading back an array of associative array, in a ruby like way. saying i have something like : ...
    3. array data matches but array created in loop doesn't work
      I have the exact same data in two arrays, but only the array created like so will work: $spaw_imglibs = array( array( 'value' =>...
    4. #24897 [Com]: array_multisort() will reindex the array but not if array length is 1
      ID: 24897 Comment by: franklin_se at hotmail dot com Reported By: chro at sokrates dot uio dot no Status: ...
    5. #24897 [Opn->Asn]: array_multisort() will reindex the array but not if array length is 1
      ID: 24897 Updated by: sniper@php.net Reported By: chro at sokrates dot uio dot no -Status: Open +Status: ...
  3. #2

    Default Re: asp array

    I know to pass arrays between javascript and VBScript, you have to pack it
    into a string, pass it, then upack it. For VBScript it's easy:
    myString = Join(myArray,", ")
    myArray = Split(myString,", ")

    I don't know how to join or split an array in javascript, but I bet a Google
    search on "Javascript array from string" or "Javascript split string" or
    something will get you someone who does.

    "-D-" <webforumsuser@macromedia.com> wrote in message
    news:cvnu0j$ehp$1@forums.macromedia.com...
    > I have a recordset value that is within a Do While Loop: <input
    name='fieldA'
    > type='hidden' id='fieldA'
    > value='<%=(rsAllocation.Fields.Item('ABR_DETLS_ID' ).Value)%>'> Every
    iteration
    > of the loop holds another value. So, if the loop executed 5 times, then I
    have
    > 5 hidden fields with different values from the resultset. I want to
    capture
    > the all the values into an array and then pass the array as an argument
    into a
    > javascript function. I've had no difficulty passing in arguments that hold
    one
    > value, but I'm not sure how to handle multiple values? I have a variable
    that
    > I set as the counter for the Do While loop, so the loop counter variable
    holds
    > the number of loops that were executed. Creating my array as follows,
    would
    > this hold all the hidden field values from the resultset: Dim
    > myArray(loopCounter) Dim i For i = 0 to loopCounter myArray(i) =
    > rsAllocation.Fields.Item('ABR_DETLS_ID').Value Next then I want to pass
    in the
    > array as an argument to a javascript function: onClick='return
    > CheckForm='<%=myArray()%>' Should the array then hold the hidden field
    values
    > in a one dimensional comma delimited list? I can then split the values
    out
    > from the list and then use them in the function? Thanks, -D-
    >

    CMBergin Guest

  4. #3

    Default Re: asp array

    the same more or less:

    myString = myArray.join();

    myArray = myString.split(",");

    CMBergin wrote:
    > I know to pass arrays between javascript and VBScript, you have to pack it
    > into a string, pass it, then upack it. For VBScript it's easy:
    > myString = Join(myArray,", ")
    > myArray = Split(myString,", ")
    >
    > I don't know how to join or split an array in javascript, but I bet a Google
    > search on "Javascript array from string" or "Javascript split string" or
    > something will get you someone who does.
    >
    Manuel Socarras Guest

  5. #4

    Default Re: asp array

    Hi CM, Thanks for your help and Manuels. Okay, if I understand correctly, I
    can get get all the values from the resultset by creating my array like the
    following: Dim myArray(loopCounter) Dim i For i = 0 to loopCounter myArray(i)
    = rsAllocation.Fields.Item('ABR_DETLS_ID').Value Next That should populate the
    array with every value for the recordset value 'ABR_DETLS_ID, yes? Then I need
    to create a string in VBScript from the array? myString = Join(myArray,', ')
    At that point, I can pass the string into the Javascript function:
    onClick='return CheckForm='<%=myString%>' Finally, in the Javascript function,
    I need to unpack it using the Javascript method: myArray =
    myString.split(','); Is that correct? Thanks again! -D-

    -D- Guest

  6. #5

    Default Re: asp array

    Got it in one!
    Don't you love how complicated things can get?

    "-D-" <webforumsuser@macromedia.com> wrote in message
    news:cvo525$odk$1@forums.macromedia.com...
    > Hi CM, Thanks for your help and Manuels. Okay, if I understand correctly,
    I
    > can get get all the values from the resultset by creating my array like
    the
    > following: Dim myArray(loopCounter) Dim i For i = 0 to loopCounter
    myArray(i)
    > = rsAllocation.Fields.Item('ABR_DETLS_ID').Value Next That should
    populate the
    > array with every value for the recordset value 'ABR_DETLS_ID, yes? Then I
    need
    > to create a string in VBScript from the array? myString = Join(myArray,',
    ')
    > At that point, I can pass the string into the Javascript function:
    > onClick='return CheckForm='<%=myString%>' Finally, in the Javascript
    function,
    > I need to unpack it using the Javascript method: myArray =
    > myString.split(','); Is that correct? Thanks again! -D-
    >

    CMBergin Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139