Copied to clipboard

Flag this post as spam?

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


  • Tommel 6 posts 106 karma points
    Feb 28, 2018 @ 14:25
    Tommel
    0

    How to format date in Formulate datepicker field on front-end

    Hi,

    Any idea how to format date in Formulate datepicker field on front-end? Currently it is MM-DD-YYYY (month - day - year) but i would like it to be DD-MM-YYYY (day - month - year)

    Thanks!

  • Nicholas Westby 1901 posts 6355 karma points c-trib
    Mar 05, 2018 @ 17:38
    Nicholas Westby
    0

    You can display Formulate fields however you like on the frontend: http://www.formulate.rocks/articles/custom-field-types

    That guide shows how to create an entirely new field type, but you can also just modify the frontend of an existing field type (such as the date field).

    Just be sure the value gets sent to the server in the exact same way as it currently does, or weird things might happen.

  • Tommel 6 posts 106 karma points
    Mar 06, 2018 @ 11:19
    Tommel
    0

    Hi Nicholas, thanks! I tried to find the datetime picker field but i can't find it. Any hints?

  • Nicholas Westby 1901 posts 6355 karma points c-trib
    Mar 06, 2018 @ 16:40
    Nicholas Westby
    100

    I assume you're looking for Formulate's built-in date picker. Here are the files you'll be interested in for that:

    • DateField.cs The server-side field type definition.
    • dateField.html The back office AngularJS directive template. You probably don't care much about this.
    • dateField.js The back office AngularJS directive JavaScript. You probably don't care much about this.
    • builtin-types.js (line 234) The frontend JavaScript to render the field.
    • index.js (line 28) The frontend JavaScript that associates the field to the rendering function.

    Again, you'll want to override the frontend rendering of the field. It's entirely up to you how you want to go about that (e.g., you could use some third-party AngularJS date picker).

  • Tommel 6 posts 106 karma points
    Mar 07, 2018 @ 10:39
    Tommel
    0

    Thanks for the hints. I will see if i can solve it now.

Please Sign in or register to post replies

Write your reply to:

Draft