Advance Date Picker

ldicker4949
ldicker4949 Community Member Posts: 20
I have a question that expands my earlier date picker question.

In my course, I now need to have two entry field interact with each other so that they will recognize if one is earlier or later than the other. I've tried several methods, none of which have been very successful as of yet. You can see some of my earlier attempts posted under my earlier topic.

 

Below hopeful will be the sample file I'm using to test the date picker with some of the other functions I need on the same page for the course.

 

Thank you for you help.

Comments

  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    I tried to look at the attached example but it produces a lot of Lectora errors when published - actions point to objects that don't exist etc. Anyhow, I think I understand what you are trying to achieve. I don't think Lectora can compare two dates, just normal numbers. But one could write a JS function for that.
  • ldicker4949
    ldicker4949 Community Member Posts: 20
    Is it possible to collect the dates from the user and then convert the dates to recognizable numbers for Lectora to than compare before moving forward.

    Is there a place where the dates are stored internal, that I can access to than compare with/against in Lectora.
  • klaatu
    klaatu Community Member Posts: 988
    This should help. I did not want to go the route of adding jQuery and jQuery UI for this so I just changed the Lectora input to a date type. Since input type="date" currently only works in Edge, Chrome, Opera and Android use one of these to preview. If you use one of the other browsers make sure you enter the date as mm/dd/yyyy.

    Is this something like you're thinking?

    Darrel
  • ldicker4949
    ldicker4949 Community Member Posts: 20
    This is exactly what I'm looking for... except instead of Lectora noticing me of which date is greater or less than. I need to add actions to each set of conditions.

     

    For example,

    If the InDate is greater than the OutDate, Lectora will display message to user and than maybe reset page.

    If Indate is Less than or Equal To Outdate, Lectora will move onto next action or page.
  • klaatu
    klaatu Community Member Posts: 988
    You can fire off an action in by calling the HTML Name of the action with parentheses() and a semi-colon;, like this:

    action466();

    This will trigger action466.

    You can trigger a group of actions by calling runGroup_og495();

    This will trigger group og495.

    I like to hold individual actions that I will trigger using JavaScript in an action group just to keep things tidy.

    Darrel
  • klaatu
    klaatu Community Member Posts: 988
    Whoops, I just realized that I made the equal dates just put out a notification. Here's your first test, fix my code so that the conditional that checks the dates will send the user to the next page instead. Hint, you can re-use an already established action..