Mustafa_s
Member
Hi Guys,
I have the javascript snippet below that I'm using to hide specific form elements depending on the current logged on user. The Javascript is called OnLoad and is set on the ddp___Currentloggeduser element.
ddp___user is a user element that stores the user who created the record.
ddp___Currentloggeduser is a calc element that returns the current logged on user
ddp_12_repeat___attachments_delete_span is what I'm trying to hide.
If the current logged on user matches the user who created the record than make the attachments element visibile, else make it hidden. For whatever the reason it's always hidden. Is this because my values in the DB are all NULL?
There must be a more elegant way to do this, surely I'm not being creative enough?
Any guidance or comment is appreciated, this is the final peace of the puzzle for me.
Regards.
I have the javascript snippet below that I'm using to hide specific form elements depending on the current logged on user. The Javascript is called OnLoad and is set on the ddp___Currentloggeduser element.
ddp___user is a user element that stores the user who created the record.
ddp___Currentloggeduser is a calc element that returns the current logged on user
ddp_12_repeat___attachments_delete_span is what I'm trying to hide.
Code:
$user =& JFactory::getUser();
return $user->get('username');
There must be a more elegant way to do this, surely I'm not being creative enough?
Code:
var user = Fabrik.getBlock('form_3').elements.get('ddp___user');
var currentuser = Fabrik.getBlock('form_3').elements.get('ddp___Currentloggeduser').getValue();
var attach1 = Fabrik.getBlock('form_3').elements.get('ddp_12_repeat___attachments_delete_span');
if (user==currentuser)
{
document.getElementById('ddp_12_repeat___attachments_delete_span').style.visibility='visibile';
}
else
{
document.getElementById('ddp_12_repeat___attachments_delete_span').style.visibility='hidden';
}
Any guidance or comment is appreciated, this is the final peace of the puzzle for me.
Regards.