Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hi Couch,

I have been trying out your CMS and so far it is amazingly simple to set up compared to having to code a CMS from scratch.

I have a question to ask: I have been trying to allow visitors to contribute content to a site, but I would like for them to be unpublished by default, and a moderator can then pick and choose the content to publish.

So far the only difference between published and unpublished content is that the k_page_date for unpublished content is set to 0000-00-00 00:00:00. Is that how Couch is handling unpublished content? Is there a way while submitting a databound form to set the cloned page to be unpublished by default?

Thank you!
Hi and welcome, ksat90 :)

I am glad you liked Couch.

Replying to your question -
yes, you got it right. A date of '0000-00-00 00:00:00' is what makes a page unpublished.

So, if we explicitly specify that value for a submitted page, as follows, we'll get an unpublished page -
Code: Select all
<cms:if k_success >
    <cms:db_persist_form
        k_publish_date='0000-00-00 00:00:00'
    />

    ..
    ..

Hope this helps.
Yes it helps!

The other forum posts have helped alot, but it seems like a lot of information isn't put into the documentation. Will we be able to help out with that?
To add on two other related questions,
1. How do I set some other system values to the variables that users submit through the databound form?
For example, I would like k_page_title to be linked to the name of the form.
2. Also, I wanted to perform some function onto the submitted data before submitting it to the database. Where can I insert the relevant php code?

For the first question,
I was trying out (where "name" is the variable I used for the databound form)
Code: Select all
<cms:db_persist_form
    _invalidate_cache='0'
    k_publish_date='0000-00-00 00:00:00'
    k_page_title = name
.....

but it seems not to be working.
Hello, have you tried to use "frm_" prefix? For example, if you have <cms:input type="text" name="new_page_title" /> try to use <cms:db_persist_form k_page_title=frm_new_page_title />. It worked for me, maybe will be useful for you)
Musman wrote: Hello, have you tried to use "frm_" prefix? For example, if you have <cms:input type="text" name="new_page_title" /> try to use <cms:db_persist_form k_page_title=frm_new_page_title />. It worked for me, maybe will be useful for you)


Hey that worked! I didn't know I had to prefix "frm_" for the form variables.

The documentation seems to be a bit sparse at the moment. I have a suggestion: Couch can create a wiki for us to do some editing/addition to the existing user documentation.
@ksat90, the documentation page on Databound-forms has the following caveat in red -
Caveat: the discussion that follows assumes that you're already conversant with Couch's form and editable-regions concepts.
If you are new to Couch, please take some time to first study those as all the new functions discussed here build upon them

Databound-forms build upon the regular Couch 'Forms' concepts.
If you could please take a look at the docs pertaining to 'Forms' (http://www.couchcms.com/docs/concepts/forms.html), I am sure you'll get most of your answers.

Hope this helps :)
7 posts Page 1 of 1
cron