Hi Everyone,
I am looking to wrap a missed requirement validation rule into a button. The reason being, I have tables that have required inputs, and a button that will move to the next section, making the just completed section read only, all in the same view. The reason I mark the section read only is due to having a copy table rule that brings inputs down to the table in the section that opens up. I need to have the section validated that all required inputs have been completed, before it changes to read only. I have included screenshots of the form and button to hopefully help show what I am trying to do.
Current button action......this works as designed, it asks a question, if the answer is NO, there is no action, if the answer is YES, the section is marked read only and the next section opens up for inputs.
debugger;
if ($form.getValue('/my:myFields/my:Helper_Fields/my:Helper_MovetoBasic') ===''){
jQuery.confirm('Have all necessary materials been added and required inputs been completed? If not, click "No" and complete the section. Once "Yes" is chosen, this section will be disabled and no further additions or changes can be made. If edits are necessary after this section is disabled, the edits can be made in the New Materials section below.','Inputs Complete',
function() {
$form.setValue('/my:myFields/my:Helper_Fields/my:Helper_MovetoBasic','X');
$form.showGroup('grpname:Basic_Details');
});
}
What I need.....is that same rule above, to include a validation that all required inputs have been completed. If not, then some sort of flag should be thrown or it breaks the yes/no function so that the user can input the missing requirement. I am really struggling with getting this right. Any help is greatly appreciated.
Adjusted rule currently not in use as it does not workdebugger;
if($form.getValue('/my:myFields/my:Instrument_Type') == '' || $form.getValue('/my:myFields/my:Reagent_Type') == ''){
var counter = 0;
for (var i=0; i <count('/my:myFields/my:Material_Details/my:Repeating_Content/my:MD_MatNumber'); i++){
if($form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_CO') === '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_ChangeMaster') === '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_Stage') === '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_Division') == '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_MatNumber') == '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_MatDescription') === '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_Obtained') === '' || $form.getValue('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_MatType'));{
jQuery ("Missed a required field");
break;
}
else if(count('/my:myFields/my:Material_Details/my:Repeating_Content/my:MD_MatNumber') > 1 || (count('/my:myFields/my:Material_Details/my:Repeating_Content/my:MD_MatNumber') == 1)) {
counter = counter+1;
}
if(counter >= count('/my:myFields/my:Material_Details/my:Repeating_Content['+i+']/my:MD_MatNumber')){
}
}
if ($form.getValue('/my:myFields/my:Helper_Fields/my:Helper_MovetoBasic') ===''){
jQuery.confirm('Have all necessary materials been added and required inputs been completed? If not, click "No" and complete the section. Once "Yes" is chosen, this section will be disabled and no further additions or changes can be made. If edits are necessary after this section is disabled, the edits can be made in the New Materials section below.','Inputs Complete',
function() {
$form.setValue('/my:myFields/my:Helper_Fields/my:Helper_MovetoBasic','X');
$form.showGroup('grpname:Basic_Details');
});
}}
Thank you!
------------------------------
Vanessa Kutasi | Application Analyst II
IDEXX | New England WUG Leader
------------------------------