1 (edited by evilive 02/22/2013 06:14:49 am)

Topic: Inactive checkbox

The operation kinda failed if you're trying to set status from "Inactive" to "Active";  from "checked" to "unchecked" checkbox.

In this file -> "input_ui.inc"

in this function -> inactive_control_cell($id, $value, $table, $key)

at this line -> update_record_status($id, !$value, $table, $key);

Failed at !$value variable because :

if you !$value when $value = 0 >> it will return 1
if you !$value when $value = 1 >> it will return empty string >> sql will failed to update update record status

I guess if you change !$value to $value ? 0:1

That's kinda solve it.

Re: Inactive checkbox

What kind of problem do you have with this helper?
The code was implemented back in 2009 and works fine up to day.

Janusz

3 (edited by apmuthu 03/02/2013 06:47:33 pm)

Re: Inactive checkbox

Which version of FA are you using?

Lines 881 to 896 in ui_input.inc are:

function inactive_control_cell($id, $value, $table, $key)
{
    global    $Ajax;

    $name = "Inactive". $id;
    $value = $value ? 1:0;

    if (check_value('show_inactive')) {
        if (isset($_POST['LInact'][$id]) && (get_post('_Inactive'.$id.'_update') || 
            get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
            update_record_status($id, !$value, $table, $key);
        }
        echo '<td align="center">'. checkbox(null, $name, $value, true, '', "align='center'")
             . hidden("LInact[$id]", $value, false) . '</td>';    
    }
}

Your inverted ternery code - $value = $value ? 0:1; - will toggle the status.