m. lemos forms validation class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • diroddi

    m. lemos forms validation class

    How do you validate a SELECT field with m. lemos forms validation
    class. I want to make sure the user has selected a product and not left
    the field as the default of 'Select One'.

    $form->AddInput(array (
    "TYPE"=>"select ",
    "NAME"=>"produc tid",
    "ID"=>"producti d",
    "VALUE"=>"Selec tOne",
    "SIZE"=>1,
    "OPTIONS"=>arra y(
    "SelectOne"=>"S elect One",
    "1"=>"Good" ,
    "2"=>"Bette r",
    "3"=>"Best" ,
    ),
    "ValidateAsNotE mpty"=>1,
    "ValidationErro rMessage"=>"Ple ase specify a product.",
    "LABEL"=>"< u>P</u>roduct",
    "ACCESSKEY"=>"P "
    ));

    Thanks for any input you can give.
    P.S. Manuel this is an awesome class. Great Work!!

    James

  • Manuel Lemos

    #2
    Re: m. lemos forms validation class

    Hello,

    on 12/20/2004 11:26 PM diroddi said the following:[color=blue]
    > How do you validate a SELECT field with m. lemos forms validation
    > class. I want to make sure the user has selected a product and not left
    > the field as the default of 'Select One'.
    >
    > $form->AddInput(array (
    > "TYPE"=>"select ",
    > "NAME"=>"produc tid",
    > "ID"=>"producti d",
    > "VALUE"=>"Selec tOne",
    > "SIZE"=>1,
    > "OPTIONS"=>arra y(
    > "SelectOne"=>"S elect One",
    > "1"=>"Good" ,
    > "2"=>"Bette r",
    > "3"=>"Best" ,
    > ),
    > "ValidateAsNotE mpty"=>1,
    > "ValidationErro rMessage"=>"Ple ase specify a product.",
    > "LABEL"=>"< u>P</u>roduct",
    > "ACCESSKEY"=>"P "
    > ));
    >
    > Thanks for any input you can give.[/color]

    I guess I need to have a FAQ system for recurring questions! ;-)

    What I usually do is to have one option selected by default with an
    empty string as value.

    "VALUE"=>"" ,
    "OPTIONS"=>arra y(
    ""=>"Select One",
    "1"=>"Good" ,
    "2"=>"Bette r",
    "3"=>"Best" ,
    ),

    This way the ValidateAsNotEm pty will make the class prevent the default
    empty string value to be accepted.

    [color=blue]
    > P.S. Manuel this is an awesome class. Great Work!![/color]

    Thanks. ;-)

    BTW, for comments or questions specific to the forms class, it was just
    launched a forum system built in the PHP Classes site meant for authors
    to provide support to their class users. For this class the forum page
    is located here.



    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


    PHP Reviews - Reviews of PHP books and other products


    Metastorage - Data object relational mapping layer generator

    Comment

    Working...