Form validation

Permalink
Hi

I have a custom form that I need help with. It has a date picker, and I want to be able to display another custom select attribute if the date entered previously is between two dates. Can anyone help?

 
justynpride replied on at Permalink Reply
Update. On custom form there was already a date picker, and based on the date entered it displays a group that the person would be in.

I want the form to also display another select attribute if a date is entered. Can anyone help? The relevant code of the form is below. The attribute to be displayed is attendee_kidsgroup:

$('.date_of_birth input').on('change',function(){
    var dob =  $('.date_of_birth input').val();
    $('.dob_message').remove();
    $.ajax({
       url: '<?php echo $childverify; ?>',
       dataType: 'json',
       data:{
           dob: dob
       },
       success: function(response){
           $('.date_of_birth').append('<div class="clearfix dob_message"><label> </label><div class="alert-success" style="width: 200px; float:right ;  margin-top:-10px;padding:10px">Age at event : '+ response.age +' <br /> Group : '+ response.group +'</div></div>');
       }
justynpride replied on at Permalink Reply
Update: I have tool code that passes a true or false to the form if the correct criteria is met. The relevant section fo the form is

$('.date_of_birth input').on('change',function(){
       var dob =  $('.date_of_birth input').val();
      $('.dob_message').remove();
       $.ajax({
          url: '<?php echo $childverify; ?>',
          dataType: 'json',
          data:{
              dob: dob
          },
          success: function(response){
              $('.date_of_birth').append('<div class="clearfix dob_message"><label> </label><div class="alert-success" style="width: 200px; float:right ;  margin-top:-10px;padding:10px">Age at event : '+ response.age +' <br /> Group : '+ response.group +' <br /> chooseGroup : '+ response.chooseGroup +'</div></div>');
               if(response.chooseOption) {
                   $('.attendee_kidsgroup').show();
               }
          }


The code
<br /> chooseGroup : '+ response.chooseGroup +'

confirms that the relevant true or false response is passed through.

What isn't happening is the revealing of the attribute attendee_kidsgroup. There are arrays for what should be displayed and hidden and if I remove it the hidden list it appears fine, so it's just no triggering from the script.

Thoughts anyone?