Forum Discussion

KurtGombar's avatar
KurtGombar
Community Member
16 days ago

Need to make a variable date entry

Good Day! In Storyline 360, I need to create a field where the learner must enter a date that is 6 months from the present date. I would like to create a field where the date must be 6 months from today in MM/DD/YYYY format but in looking at resources and trying out some variables can't figure this out. Anyone have any suggestions? This might require Java script which I've never used I'm afraid. Anyone ever need to do this? In addition to this, I need another field where the learner picks a first of the month after this variable date. (Oy Vey!).

5 Replies

  • SBP_Inc's avatar
    SBP_Inc
    Community Member

    After seeing similar topics in the past answered by Heros I ended up needing to use javascript. AI and web searches got me pretty close, but I needed to tune a few parts. I would share the code but the client works in the security business.

    I used a trigger to run the javascript on variable change, then converted the SL text variable to a javascript date object. Given two date object - the value entered and now, the test was comparing two date objects

  • KurtGombar's avatar
    KurtGombar
    Community Member

    Thank you very much! I will look into this. Not seeing too many resources in Articulate resources for JavaScript. I did get a code from our AI bot for it which I hope works, just not sure how to execute it.

    • Nedim's avatar
      Nedim
      Community Member

      Why not transform your text entry into a more user-friendly date picker? By using a date picker, learners can easily select a date, which can then be validated and processed with additional JavaScript as needed. This improves both accessibility and the overall UI experience, making the interaction more intuitive and error-proof. See the example below, which uses the Flatpickr library to enhance both the UI and functionality.

  • SBP_Inc's avatar
    SBP_Inc
    Community Member

    Flatpickr and similar JS UI frameworks work great, but I think the core issue Kurt's seeking help solving remains outstanding.

    Welcome to PM me Kurt, and let's see if we can unblock you.

    • Nedim's avatar
      Nedim
      Community Member

      Oh, I see. I initially thought this example was doing the same thing, validating the selected (not manually entered) date against a criterion of six months from today. The validation message updates accordingly based on whether the selected date meets that condition or not. If the condition is met, another field appears to allow selection of the next date. I apparently missed the subject :(