Hi,
Hope anyone can guide me how to be able to echo out html from an db field set to view as "custom"
I'm using an javascript switch to make an ordinary input checkbox look like an iPhone switch.
When i echo out my input via "php code snippet" it works as expected, as example i can do it like this:
require_once ("saresources/included_files/sa_api2.php");
$data['extension_id'] = $_SESSION["extension_id"];
$api = new sa_api_wg();
$json = $api->post('api/shoretel/get_extension_status', $data);
$userwgstate = $json->workgroup_state;
if ($userwgstate == 1)
{
echo '<INPUT class="js-switch special js-check-change" data-action="set_extension_workgroup_state" style="display: block !important;" type="checkbox" checked>';
}
elseif ($userwgstate == 2)
{
echo '<INPUT class="js-switch special js-check-change" data-action="set_extension_workgroup_state" style="display: block !important;" type="checkbox" checked>';
}
else {
echo '<INPUT class="js-switch special js-check-change" data-action="set_extension_workgroup_state" style="display: block !important;" type="checkbox">';
}
But i need to be able to use same approach on an db field, my idea is to just do it in "custom".
My field on my edit page is called "enable_menu"
The code for custom that i'm trying:
global $data;
if ($value["enable_menu"] = 'f')
{
echo '<INPUT class="js-switch special js-check-change" data-action="set_extension_enable_menu" style="display: block !important;" type="checkbox">';
}
elseif ($value["enable_menu"] == 't')
{
echo '<INPUT class="js-switch special js-check-change" data-action="set_extension_enable_menu" style="display: block !important;" type="checkbox" checked>';
}
else {
echo = '<INPUT class="js-switch special js-check-change" data-action="set_extension_enable_menu" style="display: block !important;" type="checkbox" checked>';
}
Problem is that the page is generated as an ordinary input checkbox and not the above input with class.
(Also tried above code but with $data = '....', with same result.
Does anyone know if its possible to do what i want or do i have to use an "php code snippet" ?
/ Kristian