Hi,

I am trying to add a hidden field to a new content type I created using CCK. I've been looking for modules to add hidden fields in CCK, but haven't found any.

I'm trying to make some text invisible for users when the node is shown, and I've thought of two ways of doing it... I just don't know how to do it. This is my problem:

I have a content type called "New Case", and another one called "Section". When you create a New Case, a nid is associated with the "New Case" node you created. When you view this newly created case, one of the options available in the content section is "Add a new section to this case". Each section is associated with only ONE case, and so I need something like a node reference field in the Section type... The thing is that the node reference field shows on screen a select box where you pick a "New Case" node. In my case, the "New Case" node is picked automatically, and there is no need for it to be printed on screen.

If anyone can help me on this, I'll be truly appreciated. If you need more information on what I'm trying to do, I'll be willing to share it with you.

Thank you so much in advance.
Jose Carlos.

Comments

Jose C.’s picture

I refuse to let this thread die. I really need help on this; if any of you know of any tips to get it, I'd appreciate you telling me.

Thanks so much.
Jose Carlos.

j0k3z’s picture

edit the content template and delete any field that you dont want to show up?

Jose C.’s picture

Fisrt of all, I want to thank you for your reply. I tried your solution, but I'm facing a problem I forgot to mention before. The content of the hidden field must be PHP code... so I'm trying the "Computed field" module to see how it works. Apparently it does the job, but I'm still testing...

Thanks again.
Jose Carlos.

edward.ishaq’s picture

You can turn the field into #type value in the form alter hook
this way you can keep the same value , with out sending it to the client at all
and you will have it when the form is posted and then you can do what ever u need to do with it

wayland76’s picture

...to do this, you need the contemplate module. http://drupal.org/project/contemplate

I came to this node before, but didn't see any useful solutions, and left before figuring this out. Now that I know, I thought I'd mention it.

-=-=-=-
http://www.jdarx.info/

webcubes’s picture

Hi All,
I am in search for a technique that helps me in providing a hidden CCK field in on of my drupal installations.

If anyoine has any idea, please share.
Regards,
Lovegin.

Anonymous’s picture

Display this field
Check this box to have this field appear on your node view pages. You will usually want this unless you want your field to be a hidden value.

http://drupal.org/project/computed_field

Hope it helps!
FnL

Benjamin.chiao’s picture

Can we (reasonably easily) use the computed field module or other methods to display some fields of a nodeprofile page only to the node owner (e.g. personal identification data), to the admin (e.g. some internal remarks on a user), or to the other users (e.g. non sensitive personal data such as country, hobbies, etc)?

Benjamin.chiao’s picture

Finally I solved it using:
http://drupal.org/project/cck_field_perms Thanks.

victor871129’s picture

var hidden_fields = new Array();
hidden_fields[0] = "Apellidos: "
$(".field-label").each(function() {
if(hidden_fields.indexOf($(this).html())!=-1) {
$(this).parent().hide();
}
});

raguchi’s picture

Something like this:
http://www.uoguelph.ca/ccs/cwc/hide-field-edit-drupal-rules-module

this hides a field when editing a content, if you ignore the condition "content is published" it will hide it in any event (new content, editing, etc)

candelas’s picture

with jquery, if the client has not javascript activated, he will see.
with css, you can hide it.

look for the field wrapper that you want to hide. in drupal they have an id="name-of-your-field-wrapper". then in your .css put

#edit-field-name-of-your-field{
display: none;
}

//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong

jacobfriis’s picture

For Drupal 7 the Field Hidden module provides genuine hidden fields - text, long text, integer, decimal and floating-point - which are fully integrated with the Field API.