arian
Posts: 11
|
Posted: 10/16/2012, 3:52 AM |
|
Hi,
I have a record with a listbox control having as datasource a list of values (both values and descriptions are strings). Even if the 'required' option is set to 'yes', it still allow null values to be inserted into database.
Have you ever encounter this issue?
Any ideas?
Thanks,
Arian
|
|
|
MichaelMcDonald
Posts: 640
|
Posted: 11/10/2012, 12:32 AM |
|
It should work, but if it does not...unset required and use custom code in the on validate event:
if($Container->listboxname->GetValue() == NULL){
$Container->Errors->addError("Listbox is required");
}
You can also use < 1 or == 0 in place of NULL....
_________________
Central Coast, NSW, Australia.
|
|
|
DataDoIT
|
Posted: 11/10/2012, 6:01 AM |
|
For Listbox or Radio controls you're going to have to check for a value
using CCS's data validation rule.
Select your listbox, then in the Properties -> Data -> Validation Rule
put: CCStrLen($this->control_name->GetText() > 0
and then put in your Validation Text: "Value required dammit!"
The logic for the Validation Rule is 'if not this'. So we're checking
for 'if the string length of the field is not greater than zero'.
|
|
|
|