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

Re: [forms-dev] Re: Linked Selects -> Modify input data

Expand Messages
  • Manuel Lemos
    Hello, ... You just need to set the VALUE property of each select. Each linked select input will pick the initial group from the VALUE of its predecessor. --
    Message 1 of 13 , Aug 30, 2005
      Hello,

      on 08/30/2005 09:38 PM Kike Becerra said the following:
      > Hi again
      > I've 3 operations in my clients db:
      > - Add
      > - Modify
      > - Delete
      >
      > If user chooses ADD, i generate the form with the linked selects.
      > User chooses country=EEUU then (after 2nd select fills) he chooses
      > state=Chicago and then presses add button, and info is stored in db.
      >
      > If user chooses MODIFY, then I must generate another form, with the
      > difference that fields should not be blank, but filled with data from
      > the record that must be modified
      >
      > So, if user originally choosed country=EEUU & state=Chicago, how could
      > I do for having this automatically set in the 2 linked selects ?
      > I mean: instead of seeing
      > Country: -= SELECT A COUNTRY =-
      > State: -= SELECT A STATE =-
      >
      > I should have
      > Country: EEUU
      > State: CHICAGO
      >
      > and these 2 fields should be also linked... like the form for adding a
      > new record...

      You just need to set the VALUE property of each select. Each linked
      select input will pick the initial group from the VALUE of its predecessor.

      --

      Regards,
      Manuel Lemos

      PHP Classes - Free ready to use OOP components written in PHP
      http://www.phpclasses.org/

      PHP Reviews - Reviews of PHP books and other products
      http://www.phpclasses.org/reviews/

      Metastorage - Data object relational mapping layer generator
      http://www.meta-language.net/metastorage.html
    • Kike Becerra
      Hi again Manuel I got your reply, and well... When user clicks modify record the form shows again, with the linked selects, all right, but well, I want to
      Message 2 of 13 , Sep 5, 2005
        Hi again Manuel
        I got your reply, and well...

        When user clicks "modify record" the form shows again, with the linked
        selects, all right, but well, I want to assign a predetermined value
        to the select, but the VALUE property it is already assigned with this
        code, which fills the select

        "VALUE"=>Key($paises),

        And I'd like to:
        1- Fill each select
        2- And after 1) assign a value (from its list) to each select

        "VALUE"=>$value_user_has_in_its_record;

        Hope you've understood my idea...

        Thanks a lot for helping


        --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
        > Hello,
        >
        > on 08/30/2005 09:38 PM Kike Becerra said the following:
        > > Hi again
        > > I've 3 operations in my clients db:
        > > - Add
        > > - Modify
        > > - Delete
        > >
        > > If user chooses ADD, i generate the form with the linked selects.
        > > User chooses country=EEUU then (after 2nd select fills) he chooses
        > > state=Chicago and then presses add button, and info is stored in db.
        > >
        > > If user chooses MODIFY, then I must generate another form, with the
        > > difference that fields should not be blank, but filled with data from
        > > the record that must be modified
        > >
        > > So, if user originally choosed country=EEUU & state=Chicago, how could
        > > I do for having this automatically set in the 2 linked selects ?
        > > I mean: instead of seeing
        > > Country: -= SELECT A COUNTRY =-
        > > State: -= SELECT A STATE =-
        > >
        > > I should have
        > > Country: EEUU
        > > State: CHICAGO
        > >
        > > and these 2 fields should be also linked... like the form for adding a
        > > new record...
        >
        > You just need to set the VALUE property of each select. Each linked
        > select input will pick the initial group from the VALUE of its
        predecessor.
        >
        > --
        >
        > Regards,
        > Manuel Lemos
        >
        > PHP Classes - Free ready to use OOP components written in PHP
        > http://www.phpclasses.org/
        >
        > PHP Reviews - Reviews of PHP books and other products
        > http://www.phpclasses.org/reviews/
        >
        > Metastorage - Data object relational mapping layer generator
        > http://www.meta-language.net/metastorage.html
      • Kike Becerra
        Hi again Please ignore/delete my last message I thought the VALUE option for select was the one which served to fill the select with values, but I noticed that
        Message 3 of 13 , Sep 5, 2005
          Hi again
          Please ignore/delete my last message
          I thought the VALUE option for select was the one which served to fill
          the select with values, but I noticed that OPTIONS was really for this...
          I assigned VALUE=>$field

          And everything went ok

          Thanks !!!


          --- In forms-dev@yahoogroups.com, "Kike Becerra" <qbecerra@y...> wrote:
          > Hi again Manuel
          > I got your reply, and well...
          >
          > When user clicks "modify record" the form shows again, with the linked
          > selects, all right, but well, I want to assign a predetermined value
          > to the select, but the VALUE property it is already assigned with this
          > code, which fills the select
          >
          > "VALUE"=>Key($paises),
          >
          > And I'd like to:
          > 1- Fill each select
          > 2- And after 1) assign a value (from its list) to each select
          >
          > "VALUE"=>$value_user_has_in_its_record;
          >
          > Hope you've understood my idea...
          >
          > Thanks a lot for helping
          >
          >
          > --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
          > > Hello,
          > >
          > > on 08/30/2005 09:38 PM Kike Becerra said the following:
          > > > Hi again
          > > > I've 3 operations in my clients db:
          > > > - Add
          > > > - Modify
          > > > - Delete
          > > >
          > > > If user chooses ADD, i generate the form with the linked selects.
          > > > User chooses country=EEUU then (after 2nd select fills) he chooses
          > > > state=Chicago and then presses add button, and info is stored in db.
          > > >
          > > > If user chooses MODIFY, then I must generate another form, with the
          > > > difference that fields should not be blank, but filled with data
          from
          > > > the record that must be modified
          > > >
          > > > So, if user originally choosed country=EEUU & state=Chicago, how
          could
          > > > I do for having this automatically set in the 2 linked selects ?
          > > > I mean: instead of seeing
          > > > Country: -= SELECT A COUNTRY =-
          > > > State: -= SELECT A STATE =-
          > > >
          > > > I should have
          > > > Country: EEUU
          > > > State: CHICAGO
          > > >
          > > > and these 2 fields should be also linked... like the form for
          adding a
          > > > new record...
          > >
          > > You just need to set the VALUE property of each select. Each linked
          > > select input will pick the initial group from the VALUE of its
          > predecessor.
          > >
          > > --
          > >
          > > Regards,
          > > Manuel Lemos
          > >
          > > PHP Classes - Free ready to use OOP components written in PHP
          > > http://www.phpclasses.org/
          > >
          > > PHP Reviews - Reviews of PHP books and other products
          > > http://www.phpclasses.org/reviews/
          > >
          > > Metastorage - Data object relational mapping layer generator
          > > http://www.meta-language.net/metastorage.html
        • Kike Becerra
          Hi again (lol) I ve the 2 linked selects... When I modify a record, I set the value of the 1º select and it works, but when I try to assign a value to the 2º
          Message 4 of 13 , Sep 5, 2005
            Hi again (lol)

            I've the 2 linked selects...
            When I modify a record, I set the value of the 1º select and it works,
            but when I try to assign a value to the 2º select, it doesn't work...

            What's wrong ?
            Here i post the code for the 2º select...
            When I see the form, the 1º select is with the corresponding option
            selected, but the 2º select is with the 1º option..

            $form->AddInput(array(
            "TYPE"=>"custom",
            "ID"=>"campoprovincia",
            "NAME"=>"campoprovincia",
            "LABEL"=>"Localidad: ",
            "CustomClass"=>"form_linked_select_class",
            "VALUE"=>$camponombreloc,
            "SIZE"=>1,
            "Groups"=>$provin,
            "LinkedInput"=>"campopais",
            "ValidateAsNotEmpty"=>1,
            "ValidationErrorMessage"=>"Seleccione una localidad"
            ));

            Thanks...


            --- In forms-dev@yahoogroups.com, "Kike Becerra" <qbecerra@y...> wrote:
            > Hi again
            > Please ignore/delete my last message
            > I thought the VALUE option for select was the one which served to fill
            > the select with values, but I noticed that OPTIONS was really for
            this...
            > I assigned VALUE=>$field
            >
            > And everything went ok
            >
            > Thanks !!!
            >
            >
            > --- In forms-dev@yahoogroups.com, "Kike Becerra" <qbecerra@y...> wrote:
            > > Hi again Manuel
            > > I got your reply, and well...
            > >
            > > When user clicks "modify record" the form shows again, with the linked
            > > selects, all right, but well, I want to assign a predetermined value
            > > to the select, but the VALUE property it is already assigned with this
            > > code, which fills the select
            > >
            > > "VALUE"=>Key($paises),
            > >
            > > And I'd like to:
            > > 1- Fill each select
            > > 2- And after 1) assign a value (from its list) to each select
            > >
            > > "VALUE"=>$value_user_has_in_its_record;
            > >
            > > Hope you've understood my idea...
            > >
            > > Thanks a lot for helping
            > >
            > >
            > > --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
            > > > Hello,
            > > >
            > > > on 08/30/2005 09:38 PM Kike Becerra said the following:
            > > > > Hi again
            > > > > I've 3 operations in my clients db:
            > > > > - Add
            > > > > - Modify
            > > > > - Delete
            > > > >
            > > > > If user chooses ADD, i generate the form with the linked selects.
            > > > > User chooses country=EEUU then (after 2nd select fills) he chooses
            > > > > state=Chicago and then presses add button, and info is stored
            in db.
            > > > >
            > > > > If user chooses MODIFY, then I must generate another form,
            with the
            > > > > difference that fields should not be blank, but filled with data
            > from
            > > > > the record that must be modified
            > > > >
            > > > > So, if user originally choosed country=EEUU & state=Chicago, how
            > could
            > > > > I do for having this automatically set in the 2 linked selects ?
            > > > > I mean: instead of seeing
            > > > > Country: -= SELECT A COUNTRY =-
            > > > > State: -= SELECT A STATE =-
            > > > >
            > > > > I should have
            > > > > Country: EEUU
            > > > > State: CHICAGO
            > > > >
            > > > > and these 2 fields should be also linked... like the form for
            > adding a
            > > > > new record...
            > > >
            > > > You just need to set the VALUE property of each select. Each linked
            > > > select input will pick the initial group from the VALUE of its
            > > predecessor.
            > > >
            > > > --
            > > >
            > > > Regards,
            > > > Manuel Lemos
            > > >
            > > > PHP Classes - Free ready to use OOP components written in PHP
            > > > http://www.phpclasses.org/
            > > >
            > > > PHP Reviews - Reviews of PHP books and other products
            > > > http://www.phpclasses.org/reviews/
            > > >
            > > > Metastorage - Data object relational mapping layer generator
            > > > http://www.meta-language.net/metastorage.html
          • operationsengineer1@yahoo.com
            Kike, i can t help much here other to say i think this is supposed to be Manuel s answer (from prior post)... ... You just need to set the VALUE property of
            Message 5 of 13 , Sep 7, 2005
              Kike,

              i can't help much here other to say i think this is
              supposed to be Manuel's answer (from prior post)...

              ---
              You just need to set the VALUE property of each
              select. Each linked select input will pick the initial
              group from the VALUE of its predecessor.
              ---

              i'm not working through this issue (yet!), so the
              above doesn't make too much sense to me - especially
              my inference that the values somehow cascade through
              the linked selects.

              assuming i'm understanding you correctly...

              i assume you have variables that you use to send
              information to your db. you could create a session
              and pass those variables to the next page and then
              assign the appropriate SESSION variable (used to be db
              input variables in prior page) to the appropriate form
              element's VALUE value.

              the VALUE for each element should equal the entry
              entry into the db.

              depending on your setup you may be able to do this
              with the POST variables.

              --- Kike Becerra <qbecerra@...> wrote:

              > Hi again (lol)
              >
              > I've the 2 linked selects...
              > When I modify a record, I set the value of the 1º
              > select and it works,
              > but when I try to assign a value to the 2º select,
              > it doesn't work...
              >
              > What's wrong ?
              > Here i post the code for the 2º select...
              > When I see the form, the 1º select is with the
              > corresponding option
              > selected, but the 2º select is with the 1º option..
              >
              > $form->AddInput(array(
              > "TYPE"=>"custom",
              > "ID"=>"campoprovincia",
              > "NAME"=>"campoprovincia",
              > "LABEL"=>"Localidad: ",
              > "CustomClass"=>"form_linked_select_class",
              > "VALUE"=>$camponombreloc,
              > "SIZE"=>1,
              > "Groups"=>$provin,
              > "LinkedInput"=>"campopais",
              > "ValidateAsNotEmpty"=>1,
              > "ValidationErrorMessage"=>"Seleccione una
              > localidad"
              > ));
              >
              > Thanks...
              >
              >
              > --- In forms-dev@yahoogroups.com, "Kike Becerra"
              > <qbecerra@y...> wrote:
              > > Hi again
              > > Please ignore/delete my last message
              > > I thought the VALUE option for select was the one
              > which served to fill
              > > the select with values, but I noticed that OPTIONS
              > was really for
              > this...
              > > I assigned VALUE=>$field
              > >
              > > And everything went ok
              > >
              > > Thanks !!!
              > >
              > >
              > > --- In forms-dev@yahoogroups.com, "Kike Becerra"
              > <qbecerra@y...> wrote:
              > > > Hi again Manuel
              > > > I got your reply, and well...
              > > >
              > > > When user clicks "modify record" the form shows
              > again, with the linked
              > > > selects, all right, but well, I want to assign a
              > predetermined value
              > > > to the select, but the VALUE property it is
              > already assigned with this
              > > > code, which fills the select
              > > >
              > > > "VALUE"=>Key($paises),
              > > >
              > > > And I'd like to:
              > > > 1- Fill each select
              > > > 2- And after 1) assign a value (from its list)
              > to each select
              > > >
              > > > "VALUE"=>$value_user_has_in_its_record;
              > > >
              > > > Hope you've understood my idea...
              > > >
              > > > Thanks a lot for helping
              > > >
              > > >
              > > > --- In forms-dev@yahoogroups.com, Manuel Lemos
              > <mlemos@a...> wrote:
              > > > > Hello,
              > > > >
              > > > > on 08/30/2005 09:38 PM Kike Becerra said the
              > following:
              > > > > > Hi again
              > > > > > I've 3 operations in my clients db:
              > > > > > - Add
              > > > > > - Modify
              > > > > > - Delete
              > > > > >
              > > > > > If user chooses ADD, i generate the form
              > with the linked selects.
              > > > > > User chooses country=EEUU then (after 2nd
              > select fills) he chooses
              > > > > > state=Chicago and then presses add button,
              > and info is stored
              > in db.
              > > > > >
              > > > > > If user chooses MODIFY, then I must generate
              > another form,
              > with the
              > > > > > difference that fields should not be blank,
              > but filled with data
              > > from
              > > > > > the record that must be modified
              > > > > >
              > > > > > So, if user originally choosed country=EEUU
              > & state=Chicago, how
              > > could
              > > > > > I do for having this automatically set in
              > the 2 linked selects ?
              > > > > > I mean: instead of seeing
              > > > > > Country: -= SELECT A COUNTRY =-
              > > > > > State: -= SELECT A STATE =-
              > > > > >
              > > > > > I should have
              > > > > > Country: EEUU
              > > > > > State: CHICAGO
              > > > > >
              > > > > > and these 2 fields should be also linked...
              > like the form for
              > > adding a
              > > > > > new record...
              > > > >
              > > > > You just need to set the VALUE property of
              > each select. Each linked
              > > > > select input will pick the initial group from
              > the VALUE of its
              > > > predecessor.
              > > > >
              > > > > --
              > > > >
              > > > > Regards,
              > > > > Manuel Lemos
              > > > >
              > > > > PHP Classes - Free ready to use OOP components
              > written in PHP
              > > > > http://www.phpclasses.org/
              > > > >
              > > > > PHP Reviews - Reviews of PHP books and other
              > products
              > > > > http://www.phpclasses.org/reviews/
              > > > >
              > > > > Metastorage - Data object relational mapping
              > layer generator
              > > > > http://www.meta-language.net/metastorage.html
              >
              >
              >
              >





              ______________________________________________________
              Click here to donate to the Hurricane Katrina relief effort.
              http://store.yahoo.com/redcross-donate3/
            • Manuel Lemos
              Hello, ... The VALUE property must be one of the values of the group that is currently selected by the campopais field. -- Regards, Manuel Lemos PHP Classes -
              Message 6 of 13 , Sep 7, 2005
                Hello,

                on 09/05/2005 12:26 PM Kike Becerra said the following:
                > I've the 2 linked selects...
                > When I modify a record, I set the value of the 1º select and it works,
                > but when I try to assign a value to the 2º select, it doesn't work...
                >
                > What's wrong ?
                > Here i post the code for the 2º select...
                > When I see the form, the 1º select is with the corresponding option
                > selected, but the 2º select is with the 1º option..
                >
                > $form->AddInput(array(
                > "TYPE"=>"custom",
                > "ID"=>"campoprovincia",
                > "NAME"=>"campoprovincia",
                > "LABEL"=>"Localidad: ",
                > "CustomClass"=>"form_linked_select_class",
                > "VALUE"=>$camponombreloc,
                > "SIZE"=>1,
                > "Groups"=>$provin,
                > "LinkedInput"=>"campopais",
                > "ValidateAsNotEmpty"=>1,
                > "ValidationErrorMessage"=>"Seleccione una localidad"
                > ));

                The VALUE property must be one of the values of the group that is
                currently selected by the campopais field.


                --

                Regards,
                Manuel Lemos

                PHP Classes - Free ready to use OOP components written in PHP
                http://www.phpclasses.org/

                PHP Reviews - Reviews of PHP books and other products
                http://www.phpclasses.org/reviews/

                Metastorage - Data object relational mapping layer generator
                http://www.meta-language.net/metastorage.html
              • Mark Ty
                Just want to share my experience... I have a similar set up of using add-modify. I have one PHP file that I use for BOTH add and modify. the Add works
                Message 7 of 13 , Jul 20, 2006
                  Just want to share my experience...

                  I have a similar set up of using add-modify. I have one PHP file that
                  I use for BOTH add and modify.

                  the Add works perfectly but for modify the 2nd select was not working...

                  My Logic for MODIFY is
                  if $doit
                  SQL UPDATE
                  else
                  SQL SELECT
                  SetInputValue for all fields.

                  However, I was getting something about a VALUE is not changeable error
                  message for my linked_select code:

                  $subscription->SetInputValue("secondfield", $rs->fields["secondfield"]);




                  I found that the VALUE property must be set in the AddInput method at
                  the top of the page... which at this point I don't know if i'm running
                  in ADD or Modify or if the form WasSubmitted or Validated because I'm
                  still defining the form input fields. Now remember that normally I set
                  all my values to "" and later after runnning the "WasSubmitted" and
                  the "Validate" test I set the values for all the fields.

                  So my work around is to run the SQL twice... once at the top and again
                  in my normal place at the bottom. Because this only calls one row but
                  twice, there is minimal overhead for me. It would of been "nice" and
                  "cleaner" to just set everything with the if $doit.



                  I'm just ranting... if this rant helps someone else then well and good
                  :) If my rant show's that I did it wrong or overlooked something, then
                  I'd gladly like to hear what you have to say :)
                Your message has been successfully submitted and would be delivered to recipients shortly.