Copied to clipboard

Flag this post as spam?

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


  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2010 @ 06:17
    Sebastiaan Janssen
    0

    How to handle non-mandatory datepicker

    I am trying to post a Contour form through the API but get an exception: "System.FormatException: String was not recognized as a valid DateTime".

    The datepicker is an empty string and is not marked as a mandatory field. Of course if I enter a date, it works just fine. However when I post the form through Contour itself, I am allowed to leave it empty.

    How can I send an empty datepicker value to Contour?

  • Comment author was deleted

    Sep 13, 2010 @ 08:22

    And if you set it to null instead of an empty string (when there is no date set)?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2010 @ 08:59
    Sebastiaan Janssen
    0

    Oh, the full exception got pasted in there after all, weird, didn't think it worked...

     

    Anyway, no passing a null just gives me a nullreference exception. I'll try just skipping the field.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2010 @ 09:03
    Sebastiaan Janssen
    0

    Okay, just skipping the field in the foreach loop works, too bad that I have to explicitly check if the field is a datepicker and if it is null or empty. Would be nice if an empty string would just mean an empty string as the value. Similarly, I have to manually check if a checkbox has an empty string value and then set it to false, while empty could just implicitly mean false.

Please Sign in or register to post replies

Write your reply to:

Draft