Maybe another simple question:

I know the basics of CCK and how to add fields, such as text areas, to a content type.

Can someone please tell me how to make the text area appear as an editable field for users?

Currently, when I create content which contains a textarea, the field is editable.

But when I view the same content, I only see the text I typed into the textarea.

I hope this is not confusing.

I want something like a webform, which can be reused by each user who visits the page.

And I want the text the user entered to be saved, but not visible to other users.

Am I on the right track?

Comments

vm’s picture

seems to me you want your content type to be set as unpublished by default rather than trying to have a user access the same node expecting the node edit not to pull the previously saved content from the database.

m_i_c_h_a_e_l’s picture

Thanks Mis.

Question: I know it's not your job, but could you give me a little step-by-step?

Here's what I think I should do:

I create a node (let's say a story) called "assignment" visible to any authenticated user.

That node contains a textarea field, which the visitor can type into. Problem 1: I would like that field to appear as an open textbox when a user visits the page. I don't understand how to do that.

You said to set the content type to be unpublished by default. I don't think you mean here, because then how would the user be able to access the node in the first place?

Setting that aside for a moment, the user visits the page and types into the open textarea.

Upon submit or save, the content is saved, and the user can see his own post any time.

Any other user who visits the page will see an empty textarea, ready for typing.

Each user can see his own entry, but no other entries.

Where am I going wrong here?

As I sit here, another idea occurs to me. Can I create a forum, wherein all users can see the forum topic, and all users can post replies, but users can only see their own replies? That might be another way to do this.

vm’s picture

What you want to do you can't. In the way you want to do it. You can't think of this as a single node, with a text area, that every user who gets to it will be able to see it blank and yet, and still have it saved to the database. When the node, that has the text area is saved to the database, its issued an internal node id. and every time that single node is pulled back out of the database it will have the text area, with the previous users content.

Thus my suggestion is to create a content type
add a text area to it
under publishing options set this to unpublished.

now each user will fill out their own text box when they choose to create that content type.
Once the node is saved, it won't be able to be viewed by users.

If you want users who filled out the content type to see their own, investigate a finer grained access control module like content_access maybe.

m_i_c_h_a_e_l’s picture

Thank you very much for your advice. It really helped me to clear up a misunderstanding about the way drupal works.

I'm working on your suggestion, but I want to try one more thing.

As I explained before, my content consists of a set of instructions at the top of the page, and a writing space at the bottom.

I've decided to use each users personal blog as the workspace for submitting his writing. The navigation menu will contain a link to "my blog", but no link for "blogs". That will not hide all blogs from those who are intent on snooping, but the average user will not try to go around the nav menu. No problem there.

Question: can I put a field (or node?) on the bottom of the assignment page, which contains an open textarea of type "new blog entry"? Writing in that field would create a new blog post in the user's personal blog. Anyone else who visited the assignment page would see a similar open textarea, ready to post his own blog entry.

The user would still have to visit his own blog to see his posted content, but I think it does what I want to do.

If you say it will not work, I'll admit defeat and just put a link on the bottom of the assignment page which says "click here to submit your writing."

Thanks for your patience, and definitely for your help.

vm’s picture

if that's at all possible it would take a custom module. However, I don't believe it would be easy to have a field on a rendered content type, that any user can fill in and and create a new node based on that field that.

essentially it sounds like you want a piece of rendered content with a form embedded in it.

Seems to me you could add a block in the content that may pull this off with a link. Not at all sure about a field.

m_i_c_h_a_e_l’s picture

Thanks.

You are exactly right. I want a piece of rendered content with a form embedded in it.

I'm going to play around with a few possibilities. I am confident that drupal really does allow you to do almost anything. You just have to figure out how to do it.

I'm going to try adding either a view or possible a quicktab section to the bottom of the page.

I think I can get one tab to show a "create new blog entry". And I think (I think!) I can get the other tab to show the particular blog entry related to that assignment. taxonomy might be involved.

I'll keep plugging away.

Thanks VM.

m_i_c_h_a_e_l’s picture

VM, please stay with me just a little longer!

I'm getting close to what I'm trying to do.

If you don't mind, please take a look at this screenshot.

http://www.americanenglish.ph/images/screenshot.png

As you can see, the page contains a set of instructions for a writing assignment.

It also contains a simple link (circled in red) which opens a "new blog entry" page.

My final problem is, when you go to the new blog entry screen, you can no longer see the instructions for the writing assignment.

Do you have any thoughts on how I can carry the instruction information over to the top of the new blog entry page? Different assignment pages will have different instructions.

If this were an HTML page, I would just open the blog in an iframe below the instructions.

My final option is to have the link open in a new window, so the user can refer back to the first window to review the instructions. But that's not a pretty arrangement.

Any thoughts?

mcfilms’s picture

I often manage a project like this by using a combination of Views, Paths and Blocks. (Usually I have PathAuto installed but don't think you need that module here.)

If Views is creating this "Blog Entry Page" you can assign it a custom URL. Something like blog/assignment1 or maybe blog/assignment/[nid]

Then you can create a custom block at admin/build/block/add. It could contain the instructions you want. Then assign it to only appear in the region you want when the URL is blog/assignment1. You can use blog/* for it to be on ALL blog pages.

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

m_i_c_h_a_e_l’s picture

Mcfilms,

I like this suggestion. It sounds like what I need.

Can you help me a little with the details?

Blocks is no problem. I use them all the time.

I have Path and Views installed. I understand a little about Views (which is to say that I understand what it does).

Following your lead, and as I understand it, every user would create a new blog entry, which would automatically be assigned the url "assignment1". So every user would have his own blog entry with the url "assignment1".

Are you saying that I can use Path to assign a custom URL to a blog entry that has not been created yet?

If I understand you, I don't really think I need Views for that. Right now I am just using a link on the bottom of the assignment page, which points to node/add/blog. That opens a blank blog page.

How do I get from where I am now, to where you are suggesting I go?

Thank you so much for your help.

mcfilms’s picture

If you take a look at the docs for the pathauto module, you will see that it allows you to insert a fake "directory" in the url. So every assignment can have a url like site.com/assignment/node/243. The you can create an "instruction" block and make it only show up on pages by clicking "show ONLY on the pages listed below." And put this in the field:
assignment/*

I don't think you need Views either. But check out the pathauto module.

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

m_i_c_h_a_e_l’s picture

Mcfilms,

Thanks. I'm playing around with that idea now.

Is this possible:

The whole idea behind the way drupal (or any other CMS system) works is that it dynamically assembles nodes into a page which can be viewed on the screen.

So, is it possible to influence the "create content" command so that existing content can appear on the new page?

My mind is racing, but I see 2 possibilities:

1. Can I create variants of the blog entry template (maybe with ctools)? Each variant would have a (different) block at the top. In other words, if I have 10 different writing assignments, I would use a different variant for each assignment (with each variant having a different set of instructions permanently fixed at the top). I would have to figure out how to write the add/node/blog link to apply the correct variant.

2. Maybe easier, maybe impossible: Can I create a simple rule or action that says "when a new blog entry is going to be created, add this block at the top"?

I'm thinking that rules, or even taxonomy, might be a solution, but I can't figure out how to apply those to a bit of content that has not yet been created.

vm’s picture

what does this block do?

may be best to create a views.block with arguments depending on what the block is supposed to show.