Beginning and End Date

  • Profile Image
    biiainsurance
    Asked on January 30, 2014 at 01:09 PM

    Hey all,

    You guys have been amazing and helping me with this form. It clearly shows I am trying to do something over my head. I have a few more request but will break them down 1 post at a time if possible.

    I have now set a beginning and end date, is it possible to work it to where when a beginning date is chosen the end date will autofill 12 months out? Even if its just month/year without a day that would be awesome !!

    Let me know if this is doable or if you have a resource I can read to help ...



    Thanks again

     

  • Profile Image
    BDAVID
    Answered on January 30, 2014 at 02:30 PM

    Hi, as far as I know there is not such a thing, that would require a server side programming. You can take a look into our Date widgets. There might bet something that you might like.

  • Profile Image
    biiainsurance
    Answered on January 30, 2014 at 03:23 PM

    Could it be done with Javascript something like 

    var year = date.getFullYear(); but adding 1

    so 2014 + 1 would give 2015
    2015 + 1 would give 2016

    ?

     

  • Profile Image
    Jeanette
    Answered on January 30, 2014 at 04:50 PM

    The current calendar field got an autocalendar widget, but I think you could use the birthday picker, or a simple input type field , then do the trick with javascript to fill the field up the ending date field, just must make sure that you get the correct element ID or the class to make this to work

  • Profile Image
    Jeanette
    Answered on January 30, 2014 at 04:54 PM

    I forgot to mention that you must download the full source code of the form to accomplish what your are looking for

    Please check this guide to know How to get your Form Source Code

  • Profile Image
    biiainsurance
    Answered on January 30, 2014 at 04:56 PM

    Hey there, thank you for the reply ... I am working from the source at this point and making changes in JotForm as necessary. I have pulled the Birthday picker from the list and i would like for it to be a required field. If I was to remove the "Day" and just have month and year would that mess any of the scripting up ? or emails ?

  • Profile Image
    TitusN
    Answered on January 30, 2014 at 06:05 PM

    Hello,

    Yes, it would.

    Apart form the JS that will require a value for the 'Day' field, your form has a server-side verification for all required fields in case JS is broken.

    I would suggest that you make the Year and Month fields required using JS on your form's source-code, but not on Jotform - then you can remove the 'Day' field as you wish. 

    Here's a demonstration for making the fields required: http://jsfiddle.net/YG6mk/2/

    Your email submission would look like this with the day disabled:

    Let us know if this helps

  • Profile Image
    biiainsurance
    Answered on January 30, 2014 at 09:15 PM

    I was able to make this work so far by changing field to Birthday Date and not requiring the field "Day" then using javascript to increment the year by 1.

    Script as follows: (variables pulled and set earlier from beginning month and year)

    //add 1 to beginning year to get end year

    begyearval.onclick = begyearval.onchange = function(){

      endyearval.value = begmonthval.value+", "+(parseInt(begyearval.value) + 1);

    }

     

  • Profile Image
    biiainsurance
    Answered on January 30, 2014 at 09:17 PM

    Thanks Titus .. will read that link to see how to make the fields required.