Copied to clipboard

Flag this post as spam?

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


  • Mo 34 posts 54 karma points
    Jun 08, 2010 @ 21:46
    Mo
    0

    from - to date validation ?

    I'm a few hours away from a project deadline and failed to consider this:

    How can I implement validation for date period where two datepicker fields are concerned?

    e.g: from date should not be later than to date

     

    any help would be GREATLY appreciated! :D

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jun 08, 2010 @ 22:03
    Morten Bock
    0

    Hmm, I don't think there is any built in way to handle this.

    I have done something similar by adding a custom datatype to the document type. The datatype was a usercontrol with a validator control on it. When the document is saved, you usercontrol will get called, and you can do some coding logic to add errors to the validator, which will cause umbraco to prompt the user to correct the error before publishing.

  • Mo 34 posts 54 karma points
    Jun 08, 2010 @ 22:46
    Mo
    0

    oh no...

     

    I am stuck, no way can I put together a bug free user control in time :(

  • Mo 34 posts 54 karma points
    Jun 08, 2010 @ 23:14
    Mo
    0

    sorry morten but what do you mean by publishing? My question is in regards to contour forms and not pages (?)

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jun 08, 2010 @ 23:38
    Morten Bock
    0

    Ah, so sorry. I did not see the forum category the question was posted in.

    I'm afraid I have no experience with contour. :-/

  • Harald Ulriksen 207 posts 249 karma points
    Jun 09, 2010 @ 12:04
    Harald Ulriksen
    0

    Mo,

    I suggest adding a javascript to handle this validation.

    You could also inherit or wrap the contour renderform.ascx and alter the validations if you need serverside validation as well.

    Cheers,
    Harald.

  • Mo 34 posts 54 karma points
    Jun 20, 2010 @ 06:30
    Mo
    0

    I actually need a solution which does not need to be implemented manually for every new form, as the client requires that form management be handed to their (non-developer) staff. Any suggestions?

  • Harald Ulriksen 207 posts 249 karma points
    Jun 21, 2010 @ 09:25
    Harald Ulriksen
    0

    Then I think you're back to adding a custom fieldtype to store the two date values. However, both values will then be stored in one field in the record. This might be fine depending on their use of the collected data.

    Another option is to tell them that from/to dates fields MUST use some foo and bar as label. You can then write a javascript to handle this, but if they want a different field label your're stuck. 

    Hth,
    Harald

Please Sign in or register to post replies

Write your reply to:

Draft