Hi,
How can I use javascript to hide/show the convertlead button?
I’ve tried this but it don’t work.
<?php
require_once('include/MVC/View/views/view.detail.php');
class LeadsViewDetail extends ViewDetail
{
function display()
{
parent::display();
require_once("modules/ACLRoles/ACLRole.php");
global $current_user;
$role_to_check = "ADMIN";
$acl_role_obj = new ACLRole();
$user_roles = $acl_role_obj->getUserRoles($current_user->id);
if ( in_array($role_to_check,$user_roles) )
echo <<<EOHTML
EOHTML;
}
}
}
I just need to know the ID for convertLead button
document.getElementById('form').convert.style.display='none'; ---- Is wrong
Thanks in advance.
John
Hi John,
For future reference, using Firefox with Web Developer Extension, select View Generated Source and search that for the dropdown text. (always assuming this is what you meant)
<li><a id="convert_lead_button">Convert Lead</a><input style="display: none;" title="Convert Lead" accesskey="" class="button" onclick="document.location='index.php?module=Leads&action=ConvertLead&record=947b2081-1a5e-297c-8185-534552158432'" name="convert" id="convert_lead_button_old" value="Convert Lead" type="button"></li>
Cheers
Bruce
Hey Bruce,
Thanks for the reply, but I got that.
Somehow the java code is not being picked up in view.detail.php
If I place something like this
$(document).ready(function()
{
$("#delete_button").hide();
});
in a .js and call it from detailviewdefs.php; it works perfectly.
But that’s not the requirement, 'cause I need to show/hide buttons based on roles.
Unless there’s a way to grab the roles from within the .js file directly?
Any pointers please.
Thanks in advance.
Ok. Scratch that. Someone had changed the roles values itself. That’s why it was not working.