• Resolved mpbaweb

    (@mpbaweb)


    Hi
    I have a dropdown that selects a category one of Adult|Junior|Senior and a date box for date of birth.
    I’d like to add a validation that checks:
    If Category=Adult then DOB must be less than or equal to Today()-18years
    If Category=Junior then DOB must be more than Today()-18years
    If Category=Senior then DOB must be less than or equal to Today()-60years

    Is this possible?

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @mpbaweb

    My apologies, I did not receive the notification about your forum entry.

    I’ll try to respond to your question with a hypothetical example:

    Assuming the category field is the fieldname1 and the date field is the fieldname2.

    Please, insert a calculated field in the form, configured as hidden, and enter the following equation:

    
    (function(){
    var min_date = '-18y';
    if(fieldname1 == 'Adult') min_date = '-18y';
    if(fieldname1 == 'Senior') min_date = '-60y';
    
    getField(2).set_minDate(min_date);
    })()
    

    Best regards.

    Thread Starter mpbaweb

    (@mpbaweb)

    Thank you. That’s perfect. Solved

    • This reply was modified 2 years, 10 months ago by mpbaweb.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Date Validation’ is closed to new replies.