Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ben_a 65 posts 123 karma points
    Jul 30, 2009 @ 18:07
    ben_a
    0

    Is it possible to make "Remove at" a mandatory field?

    I need to use the standard "remove at" field in my template so that I can make API function calls against it, but I also need it to be a mandatory field. If I create my own field, I can check the checkbox to make it mandatory, but you can't edit the default fields, so....

    Any ideas? Do I need to create an event handler? I was looking for an easier solution first.

    Thanks,

    Ben

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 30, 2009 @ 18:26
    Morten Bock
    0

    There is no built in way to make the remove at field mandatory, but maybe there are other alternatives. As you mention an eventhandler could be used to either reject the save if a date is not set, or you could set a default date like today + 30 days.

    What are you planning to use it for exactly? You could consider adding you own datetime filed to the document type and make that mandatory, and simply filter out expired pages in your xslt xpath. Or maybe just copy the value from that mandatory field to the "remove at" field in an event handler.

    Do you want the documents to get unpublished, or is that just a side effect?

  • ben_a 65 posts 123 karma points
    Jul 30, 2009 @ 20:53
    ben_a
    0

    There are a couple of reasons I prefer the built-in date field.

    1. I DO want the content to unplublish automatically.

    2. I'm using the Document.GetDocumentsForExpiration() method to auto-delete expired content automatically.


    I've built a google maps page that renders each sub-content item as a point on the map using the location package. The points are related to temporary road closings, so they need to have expiration dates.

    I can create another date field, but then I have 2 fields that pretty much do the same thing, and I can't use any of the built in API, or at least not in the way I prefer.

    I think I'll create a ticket for this and see if it gets any votes.

    -Ben

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 30, 2009 @ 21:04
    Morten Bock
    100

    Ok, I see the point in using the built in functionality. I would probably go with the eventhandler then and verify that there is an expiration date before publishing the document. Would be a fair workaround I think.

  • ben_a 65 posts 123 karma points
    Jul 30, 2009 @ 21:06
    ben_a
    0

    Sounds like another reason for me to learn more about Umbraco event handlers. Thanks for the feedback.

Please Sign in or register to post replies

Write your reply to:

Draft