function validateOption() { document.getElementById("fsync_option_proformaserie_error").style.display = "none"; document.getElementById("fsync_option_daysago_error").style.display = "none"; var days = document.getElementById("fsync_option_daysago").value; $error = false; if(days == '' || !days.match(/^\d+$/)) { document.getElementById("fsync_option_daysago_error").style.display = "block"; $error = true; } var radios = document.getElementsByClassName("fsync_option_syncordersas"); for (var i = 0, length = radios.length; i < length; i++) { if (radios[i].checked) { if(radios[i].value == 'proforma' && document.getElementById("fsync_option_proformaserie").value == '') { document.getElementById("fsync_option_proformaserie_error").style.display = "block"; $error = true; } } } if($error) { return false; } else { return true; } } function submitOrderOptionForm() { if(validateOption()) { document.getElementById('save-oo-btn').classList.remove('btn-green'); document.getElementById('save-oo-btn').innerHTML = ''; document.getElementById('order_option_form').submit(); } } function showOrHideProformaSerie() { var radios = document.getElementsByClassName("fsync_option_syncordersas"); for (var i = 0, length = radios.length; i < length; i++) { if (radios[i].checked) { if(radios[i].value == 'proforma') { document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'block'; } else { document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'none'; } break; } } }