Set Field with Year

Forums Classic DFFS Set Field with Year

Viewing 1 reply thread
  • Author
    • #21503

      Hi Alexander,

      I would like to achieve following. I do have a form where I inout in New Form a Date. Based on this Date I would like to set another Field just with the Year of the Date Field on Change.

      Meaning, when a Date is set to 18.07.2018 the other field shall be set to 2018 but still being able to changed manually. When the Date Field is changed to 18.07.2017, the other field is set to 2017 but still being able to changed manually.

      How is this possible?


    • #21551
      Alexander Bautz

      Add this to your custom js:

      function setYearFromDate(){
          var date = spjs.utility.getDateFieldAsDateObject("YOUR_DATE_COLUMN");

      Change YOUR_DATE_COLUMN and YOUR_YEAR_COLUMN to match your field names.

      Add a rule in your form that triggers on change on the date column. Call the function setYearFromDate in the Run these functions / trigger these rules.

      Let me know how this works out.


Viewing 1 reply thread
  • You must be logged in to reply to this topic.