Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Enum Type and 0 index.
Re: Enum Type and 0 index. [message #394 is a reply to message #391] Mon, 13 November 2006 12:57 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
I created a field with the type enum('one', 'two', 'three') and tested it with both NULL and NOT NULL. The field was displayed as a dropdown list, and in one test I obtained the values using
function _cm_getValRep ($item='', $where)
{
    if ($item == 'enum_test') {
        $array = $this->getEnum($item);
        return $array;
    } // if
}

and in another test using
function _cm_getValRep ($item='', $where)
{
    if ($item == 'enum_test') {
        $array['one']   = 'un';
        $array['two']   = 'deux';
        $array['three'] = 'trois';
        return $array;
    } // if
}

In neither test did I have the need to change line 111 to
if (!in_array($fieldvalue, $enum, true))

I did see, however, the need to insert
    case 'enum':
        break;

before
    default:
        // perform validation if field type is numeric (integer, decimal)
        $fieldvalue = $this->validateNumber($fieldname, $fieldvalue, $fieldspec);
} // switch

I also found and fixed a problem in file 'include.xml.php4/5.inc' which inserted a blank entry into the lookup array even if there was one already there. My changed files are attached.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: std.batch.inc
Next Topic: setOrderBy function working incorrectly
Goto Forum:
  


Current Time: Thu Nov 28 12:11:54 EST 2024

Total time taken to generate the page: 0.01044 seconds