Loading ...
Sorry, an error occurred while loading the content.

Re: [forms-dev] Custom keys/values for AddInput()

Expand Messages
  • Manuel Lemos
    Hello, ... The class does not discard or change any entries of the parameters array, regardless if they are supported or not. -- Regards, Manuel Lemos
    Message 1 of 10 , Oct 22, 2006
    • 0 Attachment
      Hello,

      on 10/23/2006 10:09 AM Shekar C. Reddy said the following:
      > What I asked was, if I set some additional keys/values inside inputs
      > while doing AddInput(), such as:
      >
      > $input[ 'some_key' ] = 'some value';
      >
      > would it be possible for you retain these key/values intact all
      > through the form processing so I can refer to them later for my own
      > purposes. This would eliminate duplicating the code elsewhere in my
      > extension. Currently, the forms class discards any keys that are not
      > identified by the class itself. For the purpose of your skipping
      > these keys in your logic, you could offer a unique 'Custom' key name
      > under which I can populate my custom keys as a SUB-ARRAY so it gets
      > easier for your logic to entirely skip this sub-array of custom
      > keys. The code might look like:

      The class does not discard or change any entries of the parameters
      array, regardless if they are supported or not.

      --

      Regards,
      Manuel Lemos

      Metastorage - Data object relational mapping layer generator
      http://www.metastorage.net/

      PHP Classes - Free ready to use OOP components written in PHP
      http://www.phpclasses.org/
    • Manuel Lemos
      Hello, ... That is a private variable. It is not documented. It may change in the future. Do not access it. -- Regards, Manuel Lemos Metastorage - Data object
      Message 2 of 10 , Oct 22, 2006
      • 0 Attachment
        Hello,

        on 10/23/2006 11:02 AM Shekar C. Reddy said the following:
        > Manuel,
        >
        > I'm clearly confused! I just did:
        >
        > ...
        > $input['test'] = 'test';
        > AddInpt(...)
        >
        > I added the above element to every input in the form and later tried
        > to access $form->inputs[$input]['test'] after setting the ReadOnly=1
        > and while rendering the form in readonly mode but it resulted in an
        > error indicating that the 'test' element was discarded during
        > AddInput:
        >
        > Undefined index: test
        >
        > Further, I tried doing a print_r( $form->inputs ) right after
        > invoking LoadInputValues and noticed that none of the inputs have
        > the 'test' element in them - only the valid elements supported by
        > forms class.

        That is a private variable. It is not documented. It may change in the
        future. Do not access it.


        --

        Regards,
        Manuel Lemos

        Metastorage - Data object relational mapping layer generator
        http://www.metastorage.net/

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/
      • Shekar C. Reddy
        Manuel, I asked you this question earlier but I guess it was mis-interpreted ... http://tech.groups.yahoo.com/group/forms-dev/message/651 ... No, it only
        Message 3 of 10 , Oct 23, 2006
        • 0 Attachment
          Manuel,

          I asked you this question earlier but I guess it was mis-interpreted
          for HTML ExtraAttributes:

          -------------------------------------------------------------
          http://tech.groups.yahoo.com/group/forms-dev/message/651

          QUOTE:
          > Is it possible to store any additional attributes that we set
          > during AddInput() in the inputs array as-is and not discard them?

          No, it only stores extra HTML attributes with ExtraAttributes.
          UNQUOTE
          -------------------------------------------------------------

          What I asked was, if I set some additional keys/values inside inputs
          while doing AddInput(), such as:

          $input[ 'some_key' ] = 'some value';

          would it be possible for you retain these key/values intact all
          through the form processing so I can refer to them later for my own
          purposes. This would eliminate duplicating the code elsewhere in my
          extension. Currently, the forms class discards any keys that are not
          identified by the class itself. For the purpose of your skipping
          these keys in your logic, you could offer a unique 'Custom' key name
          under which I can populate my custom keys as a SUB-ARRAY so it gets
          easier for your logic to entirely skip this sub-array of custom
          keys. The code might look like:

          //////////////////////////////////////////////////////
          $input[ 'TYPE' ] = 'text';
          $input[ 'NAME' ] = 'Name';
          //
          // Custom keys to be retained by forms class
          $input[ 'Custom' ][ 'some_key' ] = 'some value';
          $input[ 'Custom' ][ 'another_key' ] = 'another value';
          //
          $form->AddInput( $input );
          //////////////////////////////////////////////////////

          Regards,
        • Shekar C. Reddy
          Manuel, I m clearly confused! I just did: ... $input[ test ] = test ; AddInpt(...) I added the above element to every input in the form and later tried to
          Message 4 of 10 , Oct 23, 2006
          • 0 Attachment
            Manuel,

            I'm clearly confused! I just did:

            ...
            $input['test'] = 'test';
            AddInpt(...)

            I added the above element to every input in the form and later tried
            to access $form->inputs[$input]['test'] after setting the ReadOnly=1
            and while rendering the form in readonly mode but it resulted in an
            error indicating that the 'test' element was discarded during
            AddInput:

            Undefined index: test

            Further, I tried doing a print_r( $form->inputs ) right after
            invoking LoadInputValues and noticed that none of the inputs have
            the 'test' element in them - only the valid elements supported by
            forms class.

            Please clarify...

            Thanks,




            --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
            >
            > Hello,
            >
            > on 10/23/2006 10:09 AM Shekar C. Reddy said the following:
            > > What I asked was, if I set some additional keys/values inside
            inputs
            > > while doing AddInput(), such as:
            > >
            > > $input[ 'some_key' ] = 'some value';
            > >
            > > would it be possible for you retain these key/values intact all
            > > through the form processing so I can refer to them later for my
            own
            > > purposes. This would eliminate duplicating the code elsewhere in
            my
            > > extension. Currently, the forms class discards any keys that are
            not
            > > identified by the class itself. For the purpose of your skipping
            > > these keys in your logic, you could offer a unique 'Custom' key
            name
            > > under which I can populate my custom keys as a SUB-ARRAY so it
            gets
            > > easier for your logic to entirely skip this sub-array of custom
            > > keys. The code might look like:
            >
            > The class does not discard or change any entries of the parameters
            > array, regardless if they are supported or not.
            >
            > --
            >
            > Regards,
            > Manuel Lemos
            >
            > Metastorage - Data object relational mapping layer generator
            > http://www.metastorage.net/
            >
            > PHP Classes - Free ready to use OOP components written in PHP
            > http://www.phpclasses.org/
            >
          • Shekar C. Reddy
            Manuel, I m still not clear :( You said it is a private var and not to use it. How do I go about setting custom keys in the inputs while doing AddInput?
            Message 5 of 10 , Oct 23, 2006
            • 0 Attachment
              Manuel,

              I'm still not clear :(

              You said it is a private var and not to use it. How do I go about
              setting custom keys in the inputs while doing AddInput? Currently,
              I'm storing custom data elsewhere (duplicating the keys) whereas the
              same data could be placed in one 'central' location - ASSOCIATED
              with the 'input' itself while defining it - which would make it more
              elegant and reduce redundant code/data. Would you be able to provide
              a solution to this by not discarding any custom keys not supported
              by the class during AddInput?

              Using another var, such as the private you said not to use, would
              not be of much use as I already have a separate var that stores
              custom data - relatively. What I wish to do is store the custom data
              ASSOCIATIVELY - along with the input self. In our case, we have over
              60 fields on most forms and maintaining two vars with 60 keys is a
              tad redundant. I have the logic to handle/process these custom
              keys/data - all you are requested to do is not to discard these
              custom keys during AddInput.

              Thanks,




              --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
              >
              > Hello,
              >
              > on 10/23/2006 11:02 AM Shekar C. Reddy said the following:
              > > Manuel,
              > >
              > > I'm clearly confused! I just did:
              > >
              > > ...
              > > $input['test'] = 'test';
              > > AddInpt(...)
              > >
              > > I added the above element to every input in the form and later
              tried
              > > to access $form->inputs[$input]['test'] after setting the
              ReadOnly=1
              > > and while rendering the form in readonly mode but it resulted in
              an
              > > error indicating that the 'test' element was discarded during
              > > AddInput:
              > >
              > > Undefined index: test
              > >
              > > Further, I tried doing a print_r( $form->inputs ) right after
              > > invoking LoadInputValues and noticed that none of the inputs
              have
              > > the 'test' element in them - only the valid elements supported
              by
              > > forms class.
              >
              > That is a private variable. It is not documented. It may change in
              the
              > future. Do not access it.
              >
              >
              > --
              >
              > Regards,
              > Manuel Lemos
              >
              > Metastorage - Data object relational mapping layer generator
              > http://www.metastorage.net/
              >
              > PHP Classes - Free ready to use OOP components written in PHP
              > http://www.phpclasses.org/
              >
            • Manuel Lemos
              Hello, ... The forms class is just for generating and validation forms. If you want to associate data to specific inputs which really has nothing to do with
              Message 6 of 10 , Oct 30, 2006
              • 0 Attachment
                Hello,

                on 10/23/2006 10:05 PM Shekar C. Reddy said the following:
                > Manuel,
                >
                > I'm still not clear :(
                >
                > You said it is a private var and not to use it. How do I go about
                > setting custom keys in the inputs while doing AddInput? Currently,
                > I'm storing custom data elsewhere (duplicating the keys) whereas the
                > same data could be placed in one 'central' location - ASSOCIATED
                > with the 'input' itself while defining it - which would make it more
                > elegant and reduce redundant code/data. Would you be able to provide
                > a solution to this by not discarding any custom keys not supported
                > by the class during AddInput?
                >
                > Using another var, such as the private you said not to use, would
                > not be of much use as I already have a separate var that stores
                > custom data - relatively. What I wish to do is store the custom data
                > ASSOCIATIVELY - along with the input self. In our case, we have over
                > 60 fields on most forms and maintaining two vars with 60 keys is a
                > tad redundant. I have the logic to handle/process these custom
                > keys/data - all you are requested to do is not to discard these
                > custom keys during AddInput.

                The forms class is just for generating and validation forms. If you want
                to associate data to specific inputs which really has nothing to do with
                generating and validating forms, I think it is a much more consistent
                solution to keep that data outside the class.

                Anyway, if it solves your problem, I can add support to custom input
                property that you can set and get using AddInput/SetInputProperty and
                GetInputProperty.

                --

                Regards,
                Manuel Lemos

                Metastorage - Data object relational mapping layer generator
                http://www.metastorage.net/

                PHP Classes - Free ready to use OOP components written in PHP
                http://www.phpclasses.org/
              • Shekar C. Reddy
                Manuel, Thanks much for clarifying that up! It would be great if you could support custom data to be associated along with inputs, provided it is not a
                Message 7 of 10 , Oct 31, 2006
                • 0 Attachment
                  Manuel,

                  Thanks much for clarifying that up!

                  It would be great if you could support custom data to be associated
                  along with inputs, provided it is not a Herculean task for you and
                  does not take too much of your time or effort. To me, using custom
                  data has gone a very long way in automating most of the forms
                  functionality including handling multi-page form wizards, automatic
                  data manipulation... The custom data I use deals only with
                  validations, markup and altering behavior dynamically. All of this
                  was easily possible because of the "developer-friendly" way the
                  forms class was written!

                  If you are going to offer this feature, do let me know when you are
                  done uploading the new version so I can test it.

                  Regards,




                  --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                  >
                  > Hello,
                  >
                  > on 10/23/2006 10:05 PM Shekar C. Reddy said the following:
                  > > Manuel,
                  > >
                  > > I'm still not clear :(
                  > >
                  > > You said it is a private var and not to use it. How do I go
                  about
                  > > setting custom keys in the inputs while doing AddInput?
                  Currently,
                  > > I'm storing custom data elsewhere (duplicating the keys) whereas
                  the
                  > > same data could be placed in one 'central' location - ASSOCIATED
                  > > with the 'input' itself while defining it - which would make it
                  more
                  > > elegant and reduce redundant code/data. Would you be able to
                  provide
                  > > a solution to this by not discarding any custom keys not
                  supported
                  > > by the class during AddInput?
                  > >
                  > > Using another var, such as the private you said not to use,
                  would
                  > > not be of much use as I already have a separate var that stores
                  > > custom data - relatively. What I wish to do is store the custom
                  data
                  > > ASSOCIATIVELY - along with the input self. In our case, we have
                  over
                  > > 60 fields on most forms and maintaining two vars with 60 keys is
                  a
                  > > tad redundant. I have the logic to handle/process these custom
                  > > keys/data - all you are requested to do is not to discard these
                  > > custom keys during AddInput.
                  >
                  > The forms class is just for generating and validation forms. If
                  you want
                  > to associate data to specific inputs which really has nothing to
                  do with
                  > generating and validating forms, I think it is a much more
                  consistent
                  > solution to keep that data outside the class.
                  >
                  > Anyway, if it solves your problem, I can add support to custom
                  input
                  > property that you can set and get using AddInput/SetInputProperty
                  and
                  > GetInputProperty.
                  >
                  > --
                  >
                  > Regards,
                  > Manuel Lemos
                  >
                  > Metastorage - Data object relational mapping layer generator
                  > http://www.metastorage.net/
                  >
                  > PHP Classes - Free ready to use OOP components written in PHP
                  > http://www.phpclasses.org/
                  >
                • Manuel Lemos
                  Hello, ... I finally made time to a new input property name ApplicationData that you can set to any type of value using AddInput or SetInputProperty. You can
                  Message 8 of 10 , Nov 21, 2006
                  • 0 Attachment
                    Hello,

                    on 10/31/2006 05:40 PM Shekar C. Reddy said the following:
                    > If you are going to offer this feature, do let me know when you are
                    > done uploading the new version so I can test it.

                    I finally made time to a new input property name ApplicationData that
                    you can set to any type of value using AddInput or SetInputProperty. You
                    can retrieve the property value with GetInputProperty.

                    You may download the latest version that was just updated. Sorry for the
                    delay.

                    --

                    Regards,
                    Manuel Lemos

                    Metastorage - Data object relational mapping layer generator
                    http://www.metastorage.net/

                    PHP Classes - Free ready to use OOP components written in PHP
                    http://www.phpclasses.org/
                  • Shekar C. Reddy
                    Thank you very much, Manuel! We do appreciate your time and efforts. I ll certainly use this feature right away which would go a very long way in utilizing
                    Message 9 of 10 , Nov 21, 2006
                    • 0 Attachment
                      Thank you very much, Manuel! We do appreciate your time and efforts.

                      I'll certainly use this feature right away which would go a very
                      long way in utilizing your productive class more efficiently.

                      Is there any way you could rename this attribute to just 'Data' to
                      shorten it? It is also a standard name for data attribute ('any'
                      type) in widgets such as Microsoft treeview control, listview
                      control, etc - that store custom data. There is no hurry - you could
                      take your own time as I'll go ahead and name my get/set methods for
                      this attribute to getData/setData and once you rename the attribute
                      to 'Data', all I have to do is to just modify these two methods to
                      point to 'Data'.

                      This is just a suggestion. However, if you are too busy to rename it
                      to 'Data', it's no big deal at all.

                      Best Regards,




                      --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                      >
                      > Hello,
                      >
                      > on 10/31/2006 05:40 PM Shekar C. Reddy said the following:
                      > > If you are going to offer this feature, do let me know when you
                      are
                      > > done uploading the new version so I can test it.
                      >
                      > I finally made time to a new input property name ApplicationData
                      that
                      > you can set to any type of value using AddInput or
                      SetInputProperty. You
                      > can retrieve the property value with GetInputProperty.
                      >
                      > You may download the latest version that was just updated. Sorry
                      for the
                      > delay.
                      >
                      > --
                      >
                      > Regards,
                      > Manuel Lemos
                      >
                      > Metastorage - Data object relational mapping layer generator
                      > http://www.metastorage.net/
                      >
                      > PHP Classes - Free ready to use OOP components written in PHP
                      > http://www.phpclasses.org/
                    • Manuel Lemos
                      Hello, ... Sorry, Data can t be used because there is already a property with that name in a custom input. -- Regards, Manuel Lemos Metastorage - Data object
                      Message 10 of 10 , Nov 21, 2006
                      • 0 Attachment
                        Hello,

                        on 11/21/2006 07:19 PM Shekar C. Reddy said the following:
                        > Is there any way you could rename this attribute to just 'Data' to
                        > shorten it? It is also a standard name for data attribute ('any'
                        > type) in widgets such as Microsoft treeview control, listview
                        > control, etc - that store custom data. There is no hurry - you could
                        > take your own time as I'll go ahead and name my get/set methods for
                        > this attribute to getData/setData and once you rename the attribute
                        > to 'Data', all I have to do is to just modify these two methods to
                        > point to 'Data'.
                        >
                        > This is just a suggestion. However, if you are too busy to rename it
                        > to 'Data', it's no big deal at all.

                        Sorry, Data can't be used because there is already a property with that
                        name in a custom input.

                        --

                        Regards,
                        Manuel Lemos

                        Metastorage - Data object relational mapping layer generator
                        http://www.metastorage.net/

                        PHP Classes - Free ready to use OOP components written in PHP
                        http://www.phpclasses.org/
                      Your message has been successfully submitted and would be delivered to recipients shortly.