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 4899 posts 14655 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?

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Sep 13, 2010 @ 08:22
    Tim Geyssens
    0

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

  • Sebastiaan Janssen 4899 posts 14655 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 4899 posts 14655 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.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies