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

Trapping errors on Dynamic Select

Expand Messages
  • idiroddi
    I am using database driven SELECT s that will occasionally contain a value that is not in OPTIONS (i.e. ca vs CA), at which point i get the expected error of
    Message 1 of 4 , Dec 14, 2005
    • 0 Attachment
      I am using database driven SELECT's that will occasionally contain
      a value that is not in OPTIONS (i.e. ca vs CA), at which point i get
      the expected error of 'state: it was not defined a valid input value'.

      The first OPTION in my SELECT's is always ""=>"--". How can I trap
      these errors and assign the the value to "" so that the first OPTION
      is used rather showing an error?

      Thank you
    • Manuel Lemos
      Hello, ... I am not sure if understand your question. I think you can make the initial value and set the DiscardInvalidValues parameter, so any values not
      Message 2 of 4 , Dec 23, 2005
      • 0 Attachment
        Hello,

        on 12/14/2005 06:51 PM idiroddi said the following:
        > I am using database driven SELECT's that will occasionally contain
        > a value that is not in OPTIONS (i.e. ca vs CA), at which point i get
        > the expected error of 'state: it was not defined a valid input value'.
        >
        > The first OPTION in my SELECT's is always ""=>"--". How can I trap
        > these errors and assign the the value to "" so that the first OPTION
        > is used rather showing an error?

        I am not sure if understand your question.

        I think you can make the initial value "" and set the
        DiscardInvalidValues parameter, so any values not present in the valid
        options are ignored silently.

        --

        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/
      • idiroddi
        ... value . ... The form is populated with data from a database ( via Metabase;) )when loaded. I use the VALUE attribute to assign the input data like the
        Message 3 of 4 , Dec 27, 2005
        • 0 Attachment
          --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
          >
          > Hello,
          >
          > on 12/14/2005 06:51 PM idiroddi said the following:
          > > I am using database driven SELECT's that will occasionally contain
          > > a value that is not in OPTIONS (i.e. ca vs CA), at which point i get
          > > the expected error of 'state: it was not defined a valid input
          value'.
          > >
          > > The first OPTION in my SELECT's is always ""=>"--". How can I trap
          > > these errors and assign the the value to "" so that the first OPTION
          > > is used rather showing an error?
          >
          > I am not sure if understand your question.
          >
          > I think you can make the initial value "" and set the
          > DiscardInvalidValues parameter, so any values not present in the valid
          > options are ignored silently.
          >
          > --
          >
          > 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/
          >

          The form is populated with data from a database ( via Metabase;) )when
          loaded. I use the VALUE attribute to assign the input data like the
          example below:

          $form->AddInput(array(
          "TYPE"=>"select",
          "NAME"=>"gender",
          "ID"=>"gender",
          "MAXLENGTH"=>1,
          "VALUE"=>$result_gender,
          "SIZE"=>1,
          "OPTIONS"=>array(
          ""=>"--",
          "M"=>"M",
          "F"=>"F"
          )
          ));

          If $result_gender is anything other than "", M, or F, I get the error
          'gender: it was not defined a valid input value'. How can I trap this
          error and force the "" option. I want to be able to implement this for
          all SELECT inputs, and thought there might be a better method than
          testing the data prior to load.

          Thanks again for your help.
        • Manuel Lemos
          Hello, ... You should add the missing option yourself to the array passed to the options. -- Regards, Manuel Lemos Metastorage - Data object relational mapping
          Message 4 of 4 , Jan 11, 2006
          • 0 Attachment
            Hello,

            on 12/27/2005 09:15 PM idiroddi said the following:
            >>> I am using database driven SELECT's that will occasionally contain
            >>> a value that is not in OPTIONS (i.e. ca vs CA), at which point i get
            >>> the expected error of 'state: it was not defined a valid input
            > value'.
            >>> The first OPTION in my SELECT's is always ""=>"--". How can I trap
            >>> these errors and assign the the value to "" so that the first OPTION
            >>> is used rather showing an error?
            >> I am not sure if understand your question.
            >>
            >> I think you can make the initial value "" and set the
            >> DiscardInvalidValues parameter, so any values not present in the valid
            >> options are ignored silently.

            > The form is populated with data from a database ( via Metabase;) )when
            > loaded. I use the VALUE attribute to assign the input data like the
            > example below:
            >
            > $form->AddInput(array(
            > "TYPE"=>"select",
            > "NAME"=>"gender",
            > "ID"=>"gender",
            > "MAXLENGTH"=>1,
            > "VALUE"=>$result_gender,
            > "SIZE"=>1,
            > "OPTIONS"=>array(
            > ""=>"--",
            > "M"=>"M",
            > "F"=>"F"
            > )
            > ));
            >
            > If $result_gender is anything other than "", M, or F, I get the error
            > 'gender: it was not defined a valid input value'. How can I trap this
            > error and force the "" option. I want to be able to implement this for
            > all SELECT inputs, and thought there might be a better method than
            > testing the data prior to load.

            You should add the missing option yourself to the array passed to the
            options.


            --

            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.