kenneth
kenneth

Reputation: 43

Drupal - How to hide data in "edit content"

I have a drupal site in which we have multiple custom data types. some of the data in these types we want to be able to check and edit, but not to people who happen to be walking by. i have done the following:

On the "edit content" page i want one of two things for the field containing the data mentioned:

<script language="JavaScript">
function ShowHide(divId)
{
if(document.getElementById(divId).style.display == 'none')
{
document.getElementById(divId).style.display='block';
}
else
{
document.getElementById(divId).style.display = 'none';
}
}
</script>
</head>
<body>
<a onclick ="javascript:ShowHide('HiddenDiv')" href="javascript:;"> Show/Hide</a>
<div class="mid" id="HiddenDiv" style="DISPLAY: none" >
This text was hidden
</div>

Upvotes: 0

Views: 71

Answers (1)

user3551708
user3551708

Reputation: 943

Don't use front end JavaScript, do a hook_form_alter on the page that you need to edit. For more information, please read the drupal documentation.

Upvotes: 1

Related Questions