I try to setup a filter on a value on a page of type boolean, but I can't make it work!
here is my filter (it's the no_ip filter):
Code: Select all
$filters = array(
'rows' => array(
'filter' => FILTER_VALIDATE_INT,
'pageset' => true,
'default' => '-1'
),
'page' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '1'
),
'sort_column' => array(
'filter' => FILTER_DEFAULT,
'default' => 'mac.id'
),
'sort_direction' => array(
'filter' => FILTER_DEFAULT,
'default' => 'ASC',
),
'switch' => array(
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
),
'mac_address' => array(
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
),
'ip_address' => array(
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
),
'vlan' => array(
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
),
'no_ip' => array(
'filter' => FILTER_VALIDATE_BOOLEAN,
'pageset' => true,
'default' => false
),
'description' => array(
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
)
);
Code: Select all
$no_ip = get_request_var_request("no_ip");
and on my page I do that (display):
Code: Select all
<td nowrap style='white-space: nowrap;' width="1">
No IP:
</td>
<td width="1">
<input type="checkbox" name="no_ip" value="1" <?php ($no_ip=='1')?print " checked":print "" ?> >
</td>
when I try to select my no_ip checkbox
Code: Select all
25/09/2023 14:35:50 - CMDPHP Validation Error, Variable:no_ip, Value:undefined Backtrace: (/plugins/ciscotools/ciscotools_tab.php[68]:ciscotools_displaymac(), /plugins/ciscotools/display_mac.php[77]:validate_store_request_vars(), /lib/html_utility.php[712]:die_html_input_error(), /lib/html_validate.php[64]:cacti_debug_backtrace())
25/09/2023 14:35:55 - CMDPHP Validation Error, Variable:no_ip, Value:undefined Backtrace: (/plugins/ciscotools/ciscotools_tab.php[68]:ciscotools_displaymac(), /plugins/ciscotools/display_mac.php[77]:validate_store_request_vars(), /lib/html_utility.php[712]:die_html_input_error(), /lib/html_validate.php[64]:cacti_debug_backtrace())
But if I set it up with true, then I get what I wan't, and I can clear it and still wokring.
Any help welcome