I would like to have a date time field in a document type which when I create a content based on document type, the default value of this date time field is set to NOW as default.
Currently, I have a content called newsItem which has a field relating to its publishing date. I would like it to have default value (set as current date time) to simplify the content editor task.
How can I change this current content using your package. Since this is a live web site with too much content!
Because for example we create a news as a content but we want it to publish tomorrow! Then we set the publication date properties of that to tomorrow and it will be published then!
We cannot use createDate and updateDate since we do not want to always use current date!
Before you said you wanted the value set to NOW when the node is created. You have changed your mind and are now saying that you want to store the actual publish date.
Which is correct?
For the former @createDate is sufficient.
For the latter you'd want a Document.AfterPublish event to set the document property to DateTime.Now
In both cases I'm not sure how you'd grab the publish date retrospectively for existing data.
I did not change my mind! The customer wants us to have default value for publication date and they want this default value be flexible. For some kinds of news, they mostly should be published immediately, for another category, mostly they have to be announced the next working day or simply tomorrow.
Then I would like to have a facility to set a default value for one field! For example, when I create a field for document type, In addition to add validation, description and etc. I have this facility to mention a default value as an expression.
Well - If you want to specify a default value when you create the doc type you'd need to create a custom datatype - http://www.nibble.be/?p=62 (be aware that 4.6 will change how this is done to some extent).
If you want to get Umbraco to publish the node based on the value of your custom datatype you'd need a Document.BeforePublish event to check the value of your field and either proceed with the publish or set the ReleaseDate property of the Doucment to a future date and cancel the underlying event.
Default Value in Document Type Field
Hi
I would like to have a date time field in a document type which when I create a content based on document type, the default value of this date time field is set to NOW as default.
Regards,
Nami
Hi Nami,
Check out the Standard Values package, although you can also acheive this with an Event Handler to set the value on save.
HTH,
Hendy
See: http://our.umbraco.org/projects/developer-tools/default-values-for-umbraco
Would you please explain me how I should use it! The description is a bit vague for me!
I would like to say again that I want to have a field in my content which is initialized by a default value to simplify the work of CONTENT EDITOR.
Which part do you not understand?
Currently, I have a content called newsItem which has a field relating to its publishing date. I would like it to have default value (set as current date time) to simplify the content editor task.
How can I change this current content using your package. Since this is a live web site with too much content!
I didn't develop the package - I am just recommending it.
I don't believe that the package works with existing content (you didn't mention that before).
Umbraco already stores createDate and updateDate properties, why don't you just use these?
Because for example we create a news as a content but we want it to publish tomorrow! Then we set the publication date properties of that to tomorrow and it will be published then!
We cannot use createDate and updateDate since we do not want to always use current date!
Hi Nami,
In that case, you don't need any 3rd party packages as that functionality is built-in.
On the properties tab of your news item, you'll see a publish at field with a date picker.
HTH,
Hendy
Before you said you wanted the value set to NOW when the node is created. You have changed your mind and are now saying that you want to store the actual publish date.
Which is correct?
For the former @createDate is sufficient.
For the latter you'd want a Document.AfterPublish event to set the document property to DateTime.Now
In both cases I'm not sure how you'd grab the publish date retrospectively for existing data.
Yes, But how can I set custom value to that as a default. For example I want as default all of news that I create will publish tomorrow!
Cheers
So what you want is to set a default value for the built in "Publish at" property?
Darren
I did not change my mind! The customer wants us to have default value for publication date and they want this default value be flexible. For some kinds of news, they mostly should be published immediately, for another category, mostly they have to be announced the next working day or simply tomorrow.
Then I would like to have a facility to set a default value for one field! For example, when I create a field for document type, In addition to add validation, description and etc. I have this facility to mention a default value as an expression.
Regards,
Well - If you want to specify a default value when you create the doc type you'd need to create a custom datatype - http://www.nibble.be/?p=62 (be aware that 4.6 will change how this is done to some extent).
If you want to get Umbraco to publish the node based on the value of your custom datatype you'd need a Document.BeforePublish event to check the value of your field and either proceed with the publish or set the ReleaseDate property of the Doucment to a future date and cancel the underlying event.
HTH
i did another thing for custom value, here's my example, hope it helps
Well, I think the custom data type with custom renderer is the thing that I am looking for. Thank you.
Regards,
Be cool ;)
Yap! I think this is simpler! But user could not set the default value in document type definition.
is working on a reply...