Skip to content
Snippets Groups Projects

Draft: Added conditional validation for complex relations

Merged Kapil Patel requested to merge enhancement/user-experience-with-form into develop
3 files
+ 18
3
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 14
0
$(document).on('change', '.complex_relation_section input:visible, .complex_relation_section select:visible', function() {
var is_required = false;
var $field_wrapper = $(this).closest('.complex_relation_section');
var $child_elements = $field_wrapper.find('input:visible, select:visible');
$child_elements.each(function(index, child){
if ($(child).val().length > 0){
is_required = true
}
});
is_required ? $child_elements.prop('required', true) : $child_elements.prop('required', false)
});
\ No newline at end of file
Loading