// catch time values if($(this).hasClass('af-time')) { var key = 'element-'+$(this).closest('.element').prop('id'); var ampm = $(this).closest('.element').find('.time-ampm').val(); if(ampm == undefined) ampm = ''; // no quote on undefined var value = $(this).closest('.element').find('.time-hour').val()+':'+$(this).closest('.element').find('.time-minute').val()+' '+ampm; form_value_array.push({'elementid': key, 'elementvalue': value, 'label':label}); } }); /* var i; var debug_form_values = ''; for (i = 0; i < form_value_array.length; ++i){ debug_form_values += form_value_array['elementid']+ ' | '+form_value_array['label']+ ' => '+form_value_array['elementvalue']+"\n"; } alert(debug_form_values); */ // catch required elements ids for non empty validation $('input[type=checkbox][name="requiredelement[]"]').each(function(){ requiredelement_ids.push('element-'+$(this).val()); }); // catch required email elements ids for email validation $('input[type=checkbox][name="emailrequiredelement[]"]').each(function(){ email_ids.push('element-'+$(this).val()); }); var captcha_img; var captcha_input; if($('.captcha_img').length) { captcha_img = 1; captcha_input = $('#captcha_input').val(); } $.post('../inc/form-validation.php.htm', { 'requiredelement' : requiredelement_ids , 'emailrequiredelement':email_ids , 'captcha_img':captcha_img , 'captcha_input':captcha_input , 'form_value_array':form_value_array }, function(data){ // $('#validation').hide(); // alert('DATA :'+data); response = jQuery.parseJSON(data); if(response['status'] == 'ok') { validation_message = '<div class="validationmessage">'+response['message']+'</div>'; $('.element').each(function() { if(!$(this).find('.title').html()){ $(this).slideUp('fast'); } }); $('#contactform-content').append(validation_message); } else { $('#'+submit_id).show(); for(var i=0; i<response['message'].length; i++) { $('#errormessage-'+response['message']['elementid']).append(response['message']['errormessage']); $('#errormessage-'+response['message']['elementid']).fadeIn(); } } } /* end function data */