Announcement

Collapse
No announcement yet.

Multiple form elemts with same name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multiple form elemts with same name



    Greetings,

    Does anyone have a work-around for the fact that browsers drop leading
    null values from the comma separated list of values? Everything I can
    think of demands heavy recoding of the form and receiving script, and
    maybe that=19 s the only way, but thought I=19 d ask before I recode
    everything.



    Example:

    3 input boxes named "varname" with values of 1,2 and 3 resp., creates a
    value for varname of 1,2,3

    BUT

    3 input boxes named "varname" with values of null,2 and 3 resp., =
    creates
    a value for varname of 2,3 (leading null value is dropped)



    What I need is a value for varname of ,2,3 so that max_array is still 3
    and varname[1]=3Dnull, varname[2]=3D2 and varname[3]=3D3



    Thanks,

    Bill M.




    _____ =20

    << ella for Spam Control >> has removed 246 Junk messages and set aside
    0 Maybe for me
    You can use it too - and it's FREE! www.ellaforspam.com=09



    #2
    Multiple form elemts with same name



    Hi Bill,

    Trying to visually correlate an indexed array and a comma seperated =
    string
    is not always possible if any indexes contain null values. I do not =
    believe
    that the "browser" is acually dropping anything -- I believe the =
    problem is
    simply in the way that you are trying to correlate it. Obviuosly, when =
    you
    do a miva_array_serialize(varname) you see that the indexed variable =
    values
    are now properly placed. While if I knew specifically what you were =
    trying
    to achive I would be able to be of better assitance, I suspect that if =
    you
    want to see that actual value of all of the index values and not just =
    the
    indexes that are populated, you may have to use a MvWHILE approach. Of
    course, if you MvEVAL'ed varname[2] (for example) right out of the gate =
    from
    the form submission, you would see that it would always contain the =
    proper
    value, in this case "2".

    If there is something more specific that you could offer, I'd be happy =
    to
    put my thinking cap on to help for a more specific solution.

    HTH,

    Bob



    > -----Original Message-----
    > From: Bill Matlock [mailto:[email protected]]=20
    > Sent: Saturday, February 07, 2004 1:46 PM
    > To: Miva Users List
    > Subject: [meu] Multiple form elemts with same name
    >=20
    >=20
    > Greetings,
    >=20
    > Does anyone have a work-around for the fact that browsers drop =
    leading
    > null values from the comma separated list of values? Everything I can
    > think of demands heavy recoding of the form and receiving script, and
    > maybe that=19 s the only way, but thought I=19 d ask before I recode
    > everything.
    >=20
    >=20
    >=20
    > Example:
    >=20
    > 3 input boxes named "varname" with values of 1,2 and 3 resp.,=20
    > creates a
    > value for varname of 1,2,3
    >=20
    > BUT
    >=20
    > 3 input boxes named "varname" with values of null,2 and 3=20
    > resp., creates
    > a value for varname of 2,3 (leading null value is dropped)
    >=20
    >=20
    >=20
    > What I need is a value for varname of ,2,3 so that max_array=20
    > is still 3
    > and varname[1]=3Dnull, varname[2]=3D2 and varname[3]=3D3
    >=20
    >=20
    >=20
    > Thanks,
    >=20
    > Bill M.
    >=20
    >=20
    >=20
    >=20
    > _____ =20
    >=20
    > << ella for Spam Control >> has removed 246 Junk messages and=20
    > set aside
    > 0 Maybe for me
    > You can use it too - and it's FREE! www.ellaforspam.com=09
    >=20
    >=20

    Comment


      #3
      Multiple form elemts with same name



      Hi Bill,

      In those cases where the field/index order is important, I fill empty
      formfields with a recognizable dummy value ('void'), which during the =
      form
      validation gets dropped (or glosubbed with '').

      It's a hack, but it works.

      Markus =20





      I've stopped 8,343 spam messages. You can too!
      One month FREE spam protection at <A HREF ="http://www.cloudmark.com/spamnetsig/">http://www.cloudmark.com/spamnetsig/</A>


      -----Original Message-----
      From: [email protected] [mailto:[email protected]] On =
      Behalf
      Of Bill Matlock
      Sent: Saturday, February 07, 2004 1:46 PM
      To: Miva Users List
      Subject: [meu] Multiple form elemts with same name

      Greetings,

      Does anyone have a work-around for the fact that browsers drop leading =
      null
      values from the comma separated list of values? Everything I can think =
      of
      demands heavy recoding of the form and receiving script, and maybe =
      that=19 s
      the only way, but thought I=19 d ask before I recode everything.



      Example:

      3 input boxes named "varname" with values of 1,2 and 3 resp., creates a
      value for varname of 1,2,3

      BUT

      3 input boxes named "varname" with values of null,2 and 3 resp., =
      creates a
      value for varname of 2,3 (leading null value is dropped)



      What I need is a value for varname of ,2,3 so that max_array is still 3 =
      and
      varname[1]=3Dnull, varname[2]=3D2 and varname[3]=3D3



      Thanks,

      Bill M.




      _____ =20

      << ella for Spam Control >> has removed 246 Junk messages and set aside =
      0
      Maybe for me
      You can use it too - and it's FREE! www.ellaforspam.com=09


      Comment


        #4
        Multiple form elemts with same name



        Bill Matlock wrote:
        > Greetings,
        >
        > Does anyone have a work-around for the fact that browsers drop leading
        > null values from the comma separated list of values? Everything I can
        > think of demands heavy recoding of the form and receiving script, and
        > maybe that s the only way, but thought I d ask before I recode
        > everything.

        Rather than using multiple form fields with the same name, explicitly
        create an array by naming your fields field[1], field[2], etc.

        Adam


        Comment


          #5
          Multiple form elemts with same name



          perhaps a simple workaround is to pre-populate the variables with non-nulls. (i.e, -1,
          ascii space character, ??)

          -Bruce
          ......................................
          PHOSPHOR Media
          Featuring: StoreMan - A smarter way to manage Miva Merchant(tm) Store Content.
          Download a hassle-free demo today
          <A HREF ="http://www.phosphormedia.com/go.mv?ID=listsm">http://www.phosphormedia.com/go.mv?ID=listsm</A>
          ......................................


          > -----Original Message-----
          > From: [email protected] [mailto:[email protected]]On
          > Behalf Of Robert J Miller Jr
          > Sent: Saturday, February 07, 2004 11:16 AM
          > To: 'Bill Matlock'
          > Cc: 'Miva Users List'
          > Subject: RE: [meu] Multiple form elemts with same name
          >
          >
          > Hi Bill,
          >
          > Trying to visually correlate an indexed array and a comma seperated string
          > is not always possible if any indexes contain null values. I do not believe
          > that the "browser" is acually dropping anything -- I believe the problem is
          > simply in the way that you are trying to correlate it. Obviuosly, when you
          > do a miva_array_serialize(varname) you see that the indexed variable values
          > are now properly placed. While if I knew specifically what you were trying
          > to achive I would be able to be of better assitance, I suspect that if you
          > want to see that actual value of all of the index values and not just the
          > indexes that are populated, you may have to use a MvWHILE approach. Of
          > course, if you MvEVAL'ed varname[2] (for example) right out of the gate from
          > the form submission, you would see that it would always contain the proper
          > value, in this case "2".
          >
          > If there is something more specific that you could offer, I'd be happy to
          > put my thinking cap on to help for a more specific solution.
          >
          > HTH,
          >
          > Bob
          >
          >
          >
          > > -----Original Message-----
          > > From: Bill Matlock [mailto:[email protected]]
          > > Sent: Saturday, February 07, 2004 1:46 PM
          > > To: Miva Users List
          > > Subject: [meu] Multiple form elemts with same name
          > >
          > >
          > > Greetings,
          > >
          > > Does anyone have a work-around for the fact that browsers drop leading
          > > null values from the comma separated list of values? Everything I can
          > > think of demands heavy recoding of the form and receiving script, and
          > > maybe that s the only way, but thought I d ask before I recode
          > > everything.
          > >
          > >
          > >
          > > Example:
          > >
          > > 3 input boxes named "varname" with values of 1,2 and 3 resp.,
          > > creates a
          > > value for varname of 1,2,3
          > >
          > > BUT
          > >
          > > 3 input boxes named "varname" with values of null,2 and 3
          > > resp., creates
          > > a value for varname of 2,3 (leading null value is dropped)
          > >
          > >
          > >
          > > What I need is a value for varname of ,2,3 so that max_array
          > > is still 3
          > > and varname[1]=null, varname[2]=2 and varname[3]=3
          > >
          > >
          > >
          > > Thanks,
          > >
          > > Bill M.
          > >
          > >
          > >
          > >
          > > _____
          > >
          > > << ella for Spam Control >> has removed 246 Junk messages and
          > > set aside
          > > 0 Maybe for me
          > > You can use it too - and it's FREE! www.ellaforspam.com
          > >
          > >

          Comment


            #6
            Multiple form elemts with same name



            Hi Markus, Adam:

            <Markus wrote:

            > In those cases where the field/index order is important, I fill empty
            > formfields with a recognizable dummy value ('void'), which during the form
            > validation gets dropped (or glosubbed with '').
            >
            > It's a hack, but it works.
            >

            The correct judgment is -- I think -- "It works, but it's not a hack."
            This is a perfectly adequate and time-honored method.

            Adam wrote:


            > Rather than using multiple form fields with the same name, explicitly
            > create an array by naming your fields field[1], field[2], etc.
            >


            Does this actually work!?!?

            Can you partially populate an array using an input tag merely by
            adding the subscript?

            Forgive the question, but I don't write much Miva. Still,
            I'm curious. Does the use of any Miva variable name followed by a
            subscript populate an array!?!?!?!?!?

            Jack


            Comment


              #7
              Multiple form elemts with same name



              R. Jackson Wilson wrote:
              >
              > Adam wrote:

              >>Rather than using multiple form fields with the same name, explicitly
              >>create an array by naming your fields field[1], field[2], etc.
              >
              > Does this actually work!?!?
              >
              > Can you partially populate an array using an input tag merely by
              > adding the subscript?
              >
              > Forgive the question, but I don't write much Miva. Still,
              > I'm curious. Does the use of any Miva variable name followed by a
              > subscript populate an array!?!?!?!?!?

              No, I just made it up ;) Yup, it works Jack, most of us (at least I
              thought!) have been using this method since arrays were first added to
              Miva Script. It's used extensively in the Merchant world.

              Typically, it looks something like this inside a loop.

              <input type="text" name="{'myfield['$l.i$']'}"
              value="{encodentities(g.myfield[l.i])}"...

              And if you need to pass the entire array in hidden form fields, you can
              do it in just one line (even entity encodes all the values).

              <MvHIDE FIELDS="g.myfield">

              Adam


              Comment


                #8
                Multiple form elemts with same name



                Hi Jack & Adam,

                Yes, it's a great tool as Adam has stated. Adam illustrated a
                variable-filled index value, something a bit simpler if you prefer such as
                <input type="Text" name="varname[1]"> works, although there are times, of
                course, when you are creting the indexes on the fly and you need Adam's
                approach. As I recall, there was one situation where assigning the index
                value could "only" be achived by using INDEX= over the varname[1]
                assignment, but I don't remember exactly what the situation was. If I think
                of it or find it in the next few minutes, I'll post it again.

                - Bob




                > -----Original Message-----
                > From: Adam Denning [mailto:[email protected]]
                > Sent: Saturday, February 07, 2004 4:25 PM
                > To: Miva Users
                > Subject: Re: [meu] Multiple form elemts with same name
                >
                >
                > R. Jackson Wilson wrote:
                > >
                > > Adam wrote:
                >
                > >>Rather than using multiple form fields with the same name,
                > explicitly
                > >>create an array by naming your fields field[1], field[2], etc.
                > >
                > > Does this actually work!?!?
                > >
                > > Can you partially populate an array using an input tag merely by
                > > adding the subscript?
                > >
                > > Forgive the question, but I don't write much Miva. Still,
                > > I'm curious. Does the use of any Miva variable name followed by a
                > > subscript populate an array!?!?!?!?!?
                >
                > No, I just made it up ;) Yup, it works Jack, most of us (at least I
                > thought!) have been using this method since arrays were first
                > added to
                > Miva Script. It's used extensively in the Merchant world.
                >
                > Typically, it looks something like this inside a loop.
                >
                > <input type="text" name="{'myfield['$l.i$']'}"
                > value="{encodentities(g.myfield[l.i])}"...
                >
                > And if you need to pass the entire array in hidden form
                > fields, you can
                > do it in just one line (even entity encodes all the values).
                >
                > <MvHIDE FIELDS="g.myfield">
                >
                > Adam
                >
                >

                Comment


                  #9
                  Multiple form elemts with same name



                  I've built a worksheet that will produce a shippable list of meterials
                  needed to build a new home. The user enters info from the plans into
                  form fields. For example, 1st floor walls. There can be several
                  different types and heights of walls so ther are 12 places to enter =
                  info
                  about walls - each contains the following scheme:



                  wallType (2x4,2x6,etc)

                  wallHeight (8,9,10,etc feet)

                  linearFeet (total linear feet for this type/height wall)

                  exterior (yes/no)

                  numberOfCorners (for exterior only - computes corner bracing later on)



                  Each of these "groups" fields are named the same, then deserialized on
                  the receiving end AFTER being stored in the db. Problem is, if on the
                  first group, the wall is not exterior, then the comma sep. list that's
                  stored in the db will be out of synch in regards to the other fields
                  since the numberOfCorners[1] field will be null. This doesn't happen =
                  for
                  any other location in the array. Only the #1 position. I suppose the
                  easiest fix is to make sure the user always enters exterior walls, if
                  any, on the first entry. After that, it won't matter.



                  Here's some results from some tests that I ran using the snippet in the
                  3.9 manual:



                  The main code:



                  <MvIF EXPR=3D"{commalist ne ''}">

                  <MvASSIGN NAME=3D"expected" INDEX=3D"1" VALUE=3D"value 1">

                  <MvASSIGN name=3D"EXPECTED" index=3D"2" value=3D"value 2">

                  <MvASSIGN name=3D"EXPECTED" index=3D"3" value=3D"value 3">

                  <MvASSIGN name=3D"EXPECTED" index=3D"4" value=3D"value 4">

                  <MvASSIGN name=3D"EXPECTED" index=3D"5" value=3D"value 5">

                  <MvASSIGN name=3D"EXPECTED" index=3D"6" value=3D"value 6">

                  <MvASSIGN name=3D"EXPECTED" index=3D"7" value=3D"value 7">



                  <MvASSIGN NAME=3D"l.success" VALUE=3D"1">

                  <MvASSIGN NAME=3D"l.count" VALUE=3D"{1}">

                  <MvASSIGN NAME=3D"l.max" VALUE=3D"{miva_array_max(commalist)}">

                  <MvWHILE EXPR=3D"{l.count le l.max}">

                  <MvIF EXPR=3D"{commalist[count] ne expected[count]}">

                  <MvEVAL EXPR=3D"{'failed at ' $ count $ ',
                  expected "' $ expected[count] $ '", got "' $ commalist[count] $
                  '"'}">



                  <MvASSIGN NAME=3D"l.success" value=3D"0">

                  </MvIF>

                  <MvASSIGN NAME=3D"count" VALUE=3D"{count + 1}">

                  </MvWHILE>



                  <MvIF EXPR=3D"{l.success eq 0}">

                  Failed


                  ORIGINAL: <MvEVAL EXPR =3D "{commalist$'
                  '}" >

                  <MvASSIGN NAME =3D "temp" VALUE =3D "{
                  miva_array_deserialize(commalist)}" >

                  DESERIAL ORIGINAL: <MvEVAL EXPR =3D "{temp}" >


                  <MvASSIGN NAME =3D "temp" VALUE =3D "{
                  miva_array_serialize(commalist)}" >

                  SERIAL ORIGINAL: <MvEVAL EXPR =3D "{temp}" >


                  <MvASSIGN NAME =3D "temp2" VALUE =3D "{
                  miva_array_deserialize(temp)}" >

                  DESERIAL the SERIALIZED: <MvEVAL EXPR =3D "{temp2}" >

                  <MvELSE>


                  Succeed

                  </MvIF>

                  <MvELSE>

                  Please press the button below to start the AddFormVariable test

                  </MvIF>



                  FORM: null at [1]

                  <form method=3D"post">



                  <input name=3D"commalist[1]" value=3D"" type=3D"hidden">

                  <input name=3D"commalist[2]" value=3D"value 2" type=3D"hidden">

                  <input name=3D"commalist[3]" value=3D"value 3" type=3D"hidden">

                  <input name=3D"commalist[4]" value=3D"value 4" type=3D"hidden">

                  <input name=3D"commalist[5]" value=3D"value 5" type=3D"hidden">

                  <input name=3D"commalist[6]" value=3D"value 6" type=3D"hidden">

                  <input name=3D"commalist[7]" value=3D"value 7" type=3D"hidden">

                  <input SIZE=3D"10" value=3D"Start Test" type=3D"submit">



                  </form>



                  RESULTS:

                  failed at 1, expected "value 1", got ""



                  Failed

                  ORIGINAL: value 2,value 3,value 4,value 5,value 6,value 7

                  (# What I wanted is ,value 2,value 3,value 4,value 5,value 6,value 7 #)

                  DESERIAL ORIGINAL: value 2,value 3,value 4,value 5,value 6,value 7

                  SERIAL ORIGINAL:
                  [2]=3Dvalue+2,[3]=3Dvalue+3,[4]=3Dvalue+4,[5]=3Dvalue+5,[6]=3Dvalue+6,[7=
                  ]=3Dvalue+7

                  DESERIAL the SERIALIZED: value 2,value 3,value 4,value 5,value 6,value =
                  7

                  (# I would have expected this to be
                  [1]=3D,[2]=3Dvalue+2,[3]=3Dvalue+3,[4]=3Dvalue+4,[5]=3Dvalue+5,[6]=3Dval=
                  ue+6,[7]=3Dval
                  ue+7 #)



                  ------------------------------------



                  FORM: null at [2]

                  <input name=3D"commalist[1]" value=3D"value 1" type=3D"hidden">

                  <input name=3D"commalist[2]" value=3D"" type=3D"hidden">

                  <input name=3D"commalist[3]" value=3D"value 3" type=3D"hidden">

                  <input name=3D"commalist[4]" value=3D"value 4" type=3D"hidden">

                  <input name=3D"commalist[5]" value=3D"value 5" type=3D"hidden">

                  <input name=3D"commalist[6]" value=3D"value 6" type=3D"hidden">

                  <input name=3D"commalist[7]" value=3D"value 7" type=3D"hidden">

                  <input SIZE=3D"10" value=3D"Start Test" type=3D"submit">



                  RESULTS:



                  failed at 2, expected "value 2", got ""



                  Failed

                  ORIGINAL: value 1,,value 3,value 4,value 5,value 6,value 7

                  DESERIAL ORIGINAL: value 1,,value 3,value 4,value 5,value 6,value 7

                  SERIAL ORIGINAL:
                  [1]=3Dvalue+1,[3]=3Dvalue+3,[4]=3Dvalue+4,[5]=3Dvalue+5,[6]=3Dvalue+6,[7=
                  ]=3Dvalue+7

                  (# I would have expected this to be [1]=3Dvalue+1, [2]=3D,
                  [3]=3Dvalue+3,[4]=3Dvalue+4,[5]=3Dvalue+5,[6]=3Dvalue+6,[7]=3Dvalue+7 =
                  #)

                  DESERIAL the SERIALIZED: value 1,value 3,value 4,value 5,value 6,value =
                  7

                  (# I would have expected this to be value 1,,value 3,value 4,value
                  5,value 6,value 7 #)



                  ----------------------------



                  (I notice that serializing, then deserializing, results in the equiv. =
                  of
                  miva_array_collapse)



                  On the first, the null value at [1] is omitted from the ORIGINAL from
                  the form. On the second, the null value at [2] is still there. I also
                  get the same results when not including the array index in the form
                  field.



                  So, I can't save the SERIAL ORIGINAL value to the db because
                  deserializing it to populate an array later will remove any null values
                  that occur after [1] (array_collapse) and I can't save the ORIGINAL
                  value because null values at [1] are removed. Or, rather, all null
                  values that occur before_the_first_non-null_value are removed.



                  Thanks,

                  Hope this is making sense....hehe

                  Bill M.



                  > -----Original Message-----

                  > From: [email protected]

                  > [mailto:[email protected]] On Behalf Of Robert J Miller Jr

                  > Sent: Saturday, February 07, 2004 2:16 PM

                  > To: 'Bill Matlock'

                  > Cc: 'Miva Users List'

                  > Subject: RE: [meu] Multiple form elemts with same name

                  >

                  >

                  > Hi Bill,

                  >

                  > Trying to visually correlate an indexed array and a comma

                  > seperated string is not always possible if any indexes

                  > contain null values. I do not believe that the "browser" is

                  > acually dropping anything -- I believe the problem is simply

                  > in the way that you are trying to correlate it. Obviuosly,

                  > when you do a miva_array_serialize(varname) you see that the

                  > indexed variable values are now properly placed. While if I

                  > knew specifically what you were trying to achive I would be

                  > able to be of better assitance, I suspect that if you want to

                  > see that actual value of all of the index values and not just

                  > the indexes that are populated, you may have to use a MvWHILE

                  > approach. Of course, if you MvEVAL'ed varname[2] (for

                  > example) right out of the gate from the form submission, you

                  > would see that it would always contain the proper value, in

                  > this case "2".

                  >

                  > If there is something more specific that you could offer, I'd

                  > be happy to put my thinking cap on to help for a more

                  > specific solution.

                  >

                  > HTH,

                  >

                  > Bob

                  >

                  >

                  >

                  > > -----Original Message-----

                  > > From: Bill Matlock [mailto:[email protected]]

                  > > Sent: Saturday, February 07, 2004 1:46 PM

                  > > To: Miva Users List

                  > > Subject: [meu] Multiple form elemts with same name

                  > >

                  > >

                  > > Greetings,

                  > >

                  > > Does anyone have a work-around for the fact that browsers

                  > drop leading

                  > > null values from the comma separated list of values?

                  > Everything I can

                  > > think of demands heavy recoding of the form and receiving

                  > script, and

                  > > maybe that=19 s the only way, but thought I=19 d ask before I =
                  recode

                  > > everything.

                  > >

                  > >

                  > >

                  > > Example:

                  > >

                  > > 3 input boxes named "varname" with values of 1,2 and 3 resp.,

                  > > creates a

                  > > value for varname of 1,2,3

                  > >

                  > > BUT

                  > >

                  > > 3 input boxes named "varname" with values of null,2 and 3

                  > > resp., creates

                  > > a value for varname of 2,3 (leading null value is dropped)

                  > >

                  > >

                  > >

                  > > What I need is a value for varname of ,2,3 so that max_array

                  > > is still 3

                  > > and varname[1]=3Dnull, varname[2]=3D2 and varname[3]=3D3

                  > >

                  > >

                  > >

                  > > Thanks,

                  > >

                  > > Bill M.

                  > >

                  > >

                  > >

                  > >

                  > > _____

                  > >

                  > > << ella for Spam Control >> has removed 246 Junk messages and

                  > > set aside

                  > > 0 Maybe for me

                  > > You can use it too - and it's FREE! www.ellaforspam.com =20

                  > >

                  > >

                  Comment


                    #10
                    Multiple form elemts with same name



                    Bill,

                    That isn't an issue specific to form fields, it's just how the serialize
                    and deserialize functions work (or don't work). The array elements are
                    there.

                    <MvASSIGN NAME="array[1]" VALUE="">
                    <MvASSIGN NAME="array[2]" VALUE="2">
                    <MvASSIGN NAME="array[3]" VALUE="3">
                    serialize:<MvEVAL EXPR="{miva_array_serialize(array)}"><hr>
                    1:<MvEVAL EXPR="{array[1]}">

                    2:<MvEVAL EXPR="{array[2]}">

                    3:<MvEVAL EXPR="{array[3]}">


                    You could write your own serialize/deserialize functions I guess,
                    something like this for the serialize

                    <MvASSIGN NAME="l.string" VALUE="">
                    <MvASSIGN NAME="l.i" VALUE="0">
                    <MvASSIGN NAME="l.max" VALUE="{miva_array_max(l.array)}">
                    <MvWHILE EXPR="{l.i NE l.max}">
                    <MvASSIGN NAME="l.i" VALUE="{l.i+1}">
                    <MvASSIGN NAME="l.string" VALUE="{l.string $ '[' $ l.i $ ']=' $
                    l.array[l.i] $ ','}">
                    </MvWHILE>
                    <MvASSIGN NAME="l.string" VALUE="{substring(l.string,1,len(l.string)-1)}">

                    hth,

                    Adam


                    Comment


                      #11
                      Multiple form elemts with same name



                      Hey everyone,



                      OK. For some reason, I was thinking you had to serialize the form
                      variable before the actual array was created, thus causing the loss of
                      the null values. But, since that's not the case, then it's all very
                      simple. Thanks Adam, everyone. I'll just use a custom serialize
                      function. Wow!



                      Bill M.



                      > -----Original Message-----

                      > From: [email protected]

                      > [mailto:[email protected]] On Behalf Of Adam Denning

                      > Sent: Saturday, February 07, 2004 5:38 PM

                      > To: 'Miva Users List'

                      > Subject: Re: [meu] Multiple form elemts with same name

                      >

                      >

                      > Bill,

                      >

                      > That isn't an issue specific to form fields, it's just how

                      > the serialize

                      > and deserialize functions work (or don't work). The array

                      > elements are

                      > there.

                      >

                      > <MvASSIGN NAME="array[1]" VALUE="">

                      > <MvASSIGN NAME="array[2]" VALUE="2">

                      > <MvASSIGN NAME="array[3]" VALUE="3">

                      > serialize:<MvEVAL EXPR="{miva_array_serialize(array)}"><hr>

                      > 1:<MvEVAL EXPR="{array[1]}">


                      > 2:<MvEVAL EXPR="{array[2]}">


                      > 3:<MvEVAL EXPR="{array[3]}">


                      >

                      > You could write your own serialize/deserialize functions I guess,

                      > something like this for the serialize

                      >

                      > <MvASSIGN NAME="l.string" VALUE="">

                      > <MvASSIGN NAME="l.i" VALUE="0">

                      > <MvASSIGN NAME="l.max" VALUE="{miva_array_max(l.array)}">

                      > <MvWHILE EXPR="{l.i NE l.max}">

                      > <MvASSIGN NAME="l.i" VALUE="{l.i+1}">

                      > <MvASSIGN NAME="l.string" VALUE="{l.string $ '[' $ l.i $ ']=' $

                      > l.array[l.i] $ ','}">

                      > </MvWHILE>

                      > <MvASSIGN NAME="l.string"

                      > VALUE="{substring(l.string,1,len(l.string)-1)}">

                      >

                      > hth,

                      >

                      > Adam

                      >

                      >

                      Comment

                      Working...
                      X