<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Whats the value of $var?<br>
<br>
Because it's a CCK field you may need to use<br>
$form[$var]['#type'] = 'hidden';<br>
$form[$var]['#value'] = $nid;<br>
to avoid clearing elements CCK expects to find. <br>
<br>
(Side note: I would use 'value' instead of 'hidden')<br>
<br>
Nevets<br>
<br>
<br>
On 6/28/2010 9:46 AM, Jeff Greenberg wrote:
<blockquote cite="mid:4C28B5BE.3050403@ayendesigns.com" type="cite">
<div class="moz-text-html" lang="x-western">
<p style="margin-bottom: 0cm; margin-top: 0pt;">Hi. I am hooking a
node
form. The content type has a cck node reference field, and the form
has a text field to select the node. In some cases, the user should not
be allowed to select...the value should be forced. So I decide which
field name to use based on the content type, and then change the text
field to a hidden field like this:<br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"> $form[$var] =
array(</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"> '#type' =>
'hidden',<br>
'#value' => $nid,<br>
);</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">The form comes up
just
fine. The problem is, when it is submitted, I receive:</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
<b>Fatal error</b>: Cannot unset string offsets in <b>sites\all\modules\cck\content.module</b>
on line <b>1248</b></p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">Thanks,</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">Jeff<br>
</p>
</div>
</blockquote>
<br>
</body>
</html>