Browse Source

Multi-checkbox section NPX fix

Vijayakrishnan Krishnan 4 years ago
parent
commit
083f6d1042

+ 1 - 1
app/Console/Commands/Gem.php

@@ -178,7 +178,7 @@ class Gem extends Command
                     foreach ($_node->Options as $option) {
                     foreach ($_node->Options as $option) {
                         $output .= $this->ln('<label class="d-flex align-items-center mb-1 mr-2">', $fieldLevel + 2);
                         $output .= $this->ln('<label class="d-flex align-items-center mb-1 mr-2">', $fieldLevel + 2);
                         $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
                         $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
-                            "{{ in_array('" . str_replace("'", "\\'", $option) . "', \$contentData['{$key}']) !== FALSE ? 'checked' : '' }} " .
+                            "{{ isset(\$contentData['{$key}']) && in_array('" . str_replace("'", "\\'", $option) . "', \$contentData['{$key}']) !== FALSE ? 'checked' : '' }} " .
                             'name="' . $key . '[]" value="' . $option . '" type="checkbox" class="mr-1">', $fieldLevel + 3);
                             'name="' . $key . '[]" value="' . $option . '" type="checkbox" class="mr-1">', $fieldLevel + 3);
                         $output .= $this->ln('<span>' . $option . '</span>', $fieldLevel + 3);
                         $output .= $this->ln('<span>' . $option . '</span>', $fieldLevel + 3);
                         $output .= $this->ln('</label>', $fieldLevel + 2);
                         $output .= $this->ln('</label>', $fieldLevel + 2);

+ 12 - 12
gem/forms/new-patient-intake/build/form.blade.php

@@ -675,51 +675,51 @@ $formID = rand(0, 100000);
         <label>As you know, you get three things with this program: 1) dedicated NP, 2) 24/7 access to the hotline, and 3) self-monitoring kit. What conditions or health goals do you have that you would like to see improve by participating in this program?</label>
         <label>As you know, you get three things with this program: 1) dedicated NP, 2) 24/7 access to the hotline, and 3) self-monitoring kit. What conditions or health goals do you have that you would like to see improve by participating in this program?</label>
         <div class="mt-3">
         <div class="mt-3">
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('High Blood Pressure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Blood Pressure" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('High Blood Pressure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Blood Pressure" type="checkbox" class="mr-1">
                 <span>High Blood Pressure</span>
                 <span>High Blood Pressure</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Heart Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Disease" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Heart Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Disease" type="checkbox" class="mr-1">
                 <span>Heart Disease</span>
                 <span>Heart Disease</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
                 <span>Diabetes</span>
                 <span>Diabetes</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Chronic Lung Disease or COPD', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Chronic Lung Disease or COPD" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Chronic Lung Disease or COPD', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Chronic Lung Disease or COPD" type="checkbox" class="mr-1">
                 <span>Chronic Lung Disease or COPD</span>
                 <span>Chronic Lung Disease or COPD</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('High Cholesterol', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Cholesterol" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('High Cholesterol', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Cholesterol" type="checkbox" class="mr-1">
                 <span>High Cholesterol</span>
                 <span>High Cholesterol</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Heart Failure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Failure" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Heart Failure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Failure" type="checkbox" class="mr-1">
                 <span>Heart Failure</span>
                 <span>Heart Failure</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Atherosclerotic Disease (\'Clogged Artery\')', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Atherosclerotic Disease ('Clogged Artery')" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Atherosclerotic Disease (\'Clogged Artery\')', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Atherosclerotic Disease ('Clogged Artery')" type="checkbox" class="mr-1">
                 <span>Atherosclerotic Disease ('Clogged Artery')</span>
                 <span>Atherosclerotic Disease ('Clogged Artery')</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Cancer', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Cancer" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Cancer', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Cancer" type="checkbox" class="mr-1">
                 <span>Cancer</span>
                 <span>Cancer</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Stroke', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Stroke" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Stroke', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Stroke" type="checkbox" class="mr-1">
                 <span>Stroke</span>
                 <span>Stroke</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Alzheimer\'s', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Alzheimer's" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Alzheimer\'s', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Alzheimer's" type="checkbox" class="mr-1">
                 <span>Alzheimer's</span>
                 <span>Alzheimer's</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
                 <span>Diabetes</span>
                 <span>Diabetes</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Kidney Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Kidney Disease" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Kidney Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Kidney Disease" type="checkbox" class="mr-1">
                 <span>Kidney Disease</span>
                 <span>Kidney Disease</span>
             </label>
             </label>
             <input onchange="onGemVChange_{{ $formID }}(this)" value="{{ @$contentData['current_focus_areas_other'] }}" name="current_focus_areas_other" type="text" class="form-control form-control-sm my-3" placeholder="Other">
             <input onchange="onGemVChange_{{ $formID }}(this)" value="{{ @$contentData['current_focus_areas_other'] }}" name="current_focus_areas_other" type="text" class="form-control form-control-sm my-3" placeholder="Other">

+ 12 - 12
storage/sections/new-patient-intake/form.blade.php

@@ -675,51 +675,51 @@ $formID = rand(0, 100000);
         <label>As you know, you get three things with this program: 1) dedicated NP, 2) 24/7 access to the hotline, and 3) self-monitoring kit. What conditions or health goals do you have that you would like to see improve by participating in this program?</label>
         <label>As you know, you get three things with this program: 1) dedicated NP, 2) 24/7 access to the hotline, and 3) self-monitoring kit. What conditions or health goals do you have that you would like to see improve by participating in this program?</label>
         <div class="mt-3">
         <div class="mt-3">
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('High Blood Pressure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Blood Pressure" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('High Blood Pressure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Blood Pressure" type="checkbox" class="mr-1">
                 <span>High Blood Pressure</span>
                 <span>High Blood Pressure</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Heart Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Disease" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Heart Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Disease" type="checkbox" class="mr-1">
                 <span>Heart Disease</span>
                 <span>Heart Disease</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
                 <span>Diabetes</span>
                 <span>Diabetes</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Chronic Lung Disease or COPD', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Chronic Lung Disease or COPD" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Chronic Lung Disease or COPD', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Chronic Lung Disease or COPD" type="checkbox" class="mr-1">
                 <span>Chronic Lung Disease or COPD</span>
                 <span>Chronic Lung Disease or COPD</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('High Cholesterol', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Cholesterol" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('High Cholesterol', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="High Cholesterol" type="checkbox" class="mr-1">
                 <span>High Cholesterol</span>
                 <span>High Cholesterol</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Heart Failure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Failure" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Heart Failure', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Heart Failure" type="checkbox" class="mr-1">
                 <span>Heart Failure</span>
                 <span>Heart Failure</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Atherosclerotic Disease (\'Clogged Artery\')', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Atherosclerotic Disease ('Clogged Artery')" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Atherosclerotic Disease (\'Clogged Artery\')', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Atherosclerotic Disease ('Clogged Artery')" type="checkbox" class="mr-1">
                 <span>Atherosclerotic Disease ('Clogged Artery')</span>
                 <span>Atherosclerotic Disease ('Clogged Artery')</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Cancer', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Cancer" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Cancer', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Cancer" type="checkbox" class="mr-1">
                 <span>Cancer</span>
                 <span>Cancer</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Stroke', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Stroke" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Stroke', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Stroke" type="checkbox" class="mr-1">
                 <span>Stroke</span>
                 <span>Stroke</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Alzheimer\'s', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Alzheimer's" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Alzheimer\'s', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Alzheimer's" type="checkbox" class="mr-1">
                 <span>Alzheimer's</span>
                 <span>Alzheimer's</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Diabetes', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Diabetes" type="checkbox" class="mr-1">
                 <span>Diabetes</span>
                 <span>Diabetes</span>
             </label>
             </label>
             <label class="d-flex align-items-center mb-1 mr-2">
             <label class="d-flex align-items-center mb-1 mr-2">
-                <input onchange="onGemVChange_{{ $formID }}(this)" {{ in_array('Kidney Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Kidney Disease" type="checkbox" class="mr-1">
+                <input onchange="onGemVChange_{{ $formID }}(this)" {{ isset($contentData['current_focus_areas']) && in_array('Kidney Disease', $contentData['current_focus_areas']) !== FALSE ? 'checked' : '' }} name="current_focus_areas[]" value="Kidney Disease" type="checkbox" class="mr-1">
                 <span>Kidney Disease</span>
                 <span>Kidney Disease</span>
             </label>
             </label>
             <input onchange="onGemVChange_{{ $formID }}(this)" value="{{ @$contentData['current_focus_areas_other'] }}" name="current_focus_areas_other" type="text" class="form-control form-control-sm my-3" placeholder="Other">
             <input onchange="onGemVChange_{{ $formID }}(this)" value="{{ @$contentData['current_focus_areas_other'] }}" name="current_focus_areas_other" type="text" class="form-control form-control-sm my-3" placeholder="Other">