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"=>"productid",
"ID"=>"productid",
"VALUE"=>"SelectOne",
"SIZE"=>1,
"OPTIONS"=>array(
"SelectOne"=>"Select One",
"1"=>"Good",
"2"=>"Better",
"3"=>"Best",
),
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Please 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 1 1871
Hello,
on 12/20/2004 11:26 PM diroddi said the following: 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"=>"productid", "ID"=>"productid", "VALUE"=>"SelectOne", "SIZE"=>1, "OPTIONS"=>array( "SelectOne"=>"Select One", "1"=>"Good", "2"=>"Better", "3"=>"Best", ), "ValidateAsNotEmpty"=>1, "ValidationErrorMessage"=>"Please specify a product.", "LABEL"=>"<u>P</u>roduct", "ACCESSKEY"=>"P" ));
Thanks for any input you can give.
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"=>array(
""=>"Select One",
"1"=>"Good",
"2"=>"Better",
"3"=>"Best",
),
This way the ValidateAsNotEmpty will make the class prevent the default
empty string value to be accepted.
P.S. Manuel this is an awesome class. Great Work!!
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. http://www.phpclasses.org/discuss/package/1/
--
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: diroddi |
last post by:
In reference to the Manual Lemos Form class, does anybody know if the
class does anything to prevent SQL injection attacks or provide any
kind of security by cleaning _POST variables?
Also, does...
|
by: ALthePal |
last post by:
Hi,
I'm not sure if we are able to or even how to loop through the web forms in
a VB.NET project during design time. In MSAccess we are able to go through
the database -> forms collection and...
|
by: Kathy |
last post by:
I have a form to generate a report.
On the form are several textboxes and a "Generate" button.
I would like to have the button grayed (not enabled), unless the data in
each of the dependant...
|
by: |
last post by:
Hi
Has anyone any experience using client side validation with asp.net forms.
Specifically I'd like to know...
1. How do you attach client side code web controls (a button), like a...
|
by: Anonieko Ramos |
last post by:
ASP.NET Forms Authentication Best Practices
Dr. Dobb's Journal February 2004
Protecting user information is critical
By Douglas Reilly
Douglas is the author of Designing Microsoft ASP.NET...
|
by: TJS |
last post by:
what are folks doing to get around limitation of one server form per page ?
|
by: honcho |
last post by:
My ASP.NET web application has a flaw that produces false security-violation
alarms.
There are several categories of users for this web site, e.g. Colonels,
Sergeants, Private_1s,
and...
|
by: Joshua Kendall |
last post by:
I have a script in which it keeps opening the same form
instead of only one instance. I also need help with a
form that has a password. Where do I put the actual
password? can I use a database for...
|
by: jehugaleahsa |
last post by:
Hello:
Is it me, or is handling the Validating event for every control on a
form extremely annoying? It is especially annoying when my business
logic repeats most of the validation. Some things...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |