0

I have this problem with the following code:

$(document).on('click','#add_free_ticket',function(e){
    e.preventDefault();
    $("#tab_logic").append('<tr id="free_event_clone"><td class="form-group"><input type="text" name="free_ticket_name[]" class="form-control"></div></td><td class="form-group"><input type="text" name="free_ticket_avail[]" class="form-control"></td><td class="form-group"><select class="form-control" name="free_ticket_avail_to[]"><option value="0" selected>All</option><option value="1">Members Only</option></select></td><td class="form-group"><input type="text" name="free_ticket_frm_date[]" class="form-control datetimepicker1"></td><td class="form-group"><input type="text" name="free_ticket_to_date[]"  id="tmp2" class="form-control datetimepicker2"></td><td class="form-group"><input type="text" name="free_ticket_per_guest[]" value="1" class="form-control"></td><td><button class="del_free_ticket  btn btn-danger btn-sm">X</button></td></tr>');
}  
3
  • You should not add an on() on document , take the frist element in the body for that. Commented Sep 2, 2016 at 14:48
  • Hi, JustOnUnderMillions things are working fine only creating problem with bootstrap datetimepicker, when choose date and time browser is getting hanged Commented Sep 2, 2016 at 14:54
  • Do you other event handlers within javascript? Commented Sep 2, 2016 at 15:19

1 Answer 1

2

Guys i got the solution for my question , after spending 3 days

Problem was with the fromvalidation io for dynamic added fields

on('success.field.fv', function (e, data) {
 if(data.field === 'postal_code' && !data.fv.isValidField('postal_code')) {
  data.fv.revalidateField('postal_code');
}

above code was creating problem for Maximum call stack size exceeded for this problem i have written the below code

callback: {
  message: 'Start Date and End Date can not be equal',
  callback: function (value, validator, $field) {
    var startTime = validator.getFieldElements('event_start_date').val();
    var endTime = validator.getFieldElements('event_end_date').val();
    if (startTime === endTime) {
      // The start time is also valid
      // So, we need to update its status
      validator.updateStatus('startTime', validator.STATUS_VALID, 'callback');
      return false;
    }
    return true;
  }
}

Thanks for the help :)

Sign up to request clarification or add additional context in comments.

1 Comment

Petter , you are right .. next time when i add anything i will consider it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.