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

Home » RADICORE development » Bug Reports » MySQL: Updating SET data type fields
Re: MySQL: Updating SET data type fields [message #2544 is a reply to message #2543] Sun, 30 May 2010 06:06 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2350
Registered: April 2006
Location: Surrey, UK
Senior Member
This problem only happens when the control is set to 'm_checkbox' as an unselected value is returned as '0' in the $_POST array. With a control of 'multidrop' any unselected values do not appear in the $_POST array.

The fix is quite simple. Edit file 'std.validation.class.inc' and at line 123 you should see the following:
        if (preg_match('/(set|array|varray)/i',$fieldspec['type'])) {
            // convert $fieldvalue array into a string with comma separator
            if (is_array($fieldvalue)) {
            	$fieldvalue = implode($fieldvalue, ',');
            } // if
        } // if

Simply change it to the following:
        if (preg_match('/(set|array|varray)/i',$fieldspec['type'])) {
            // convert $fieldvalue array into a string with comma separator
            if (is_array($fieldvalue)) {
                foreach ($fieldvalue as $key => $value) {
                    if (empty($value)) {
                        unset($fieldvalue[$key]);
                    } // if
                } // foreach
            	$fieldvalue = implode($fieldvalue, ',');
            } // if
        } // if

I shall include this fix in the next release.


 
Read Message
Read Message
Read Message
Previous Topic: Quick Reply not working
Next Topic: Date conversion error
Goto Forum:
  


Current Time: Fri Jun 28 23:58:06 EDT 2024

Total time taken to generate the page: 0.00965 seconds