title: What is a better way to arrange these multiple if else conditions?
body: <p>I have some user input boxes which will influence the wording of some text that is generated when some checkboxes are clicked. A simplification of the site is as follows, so I can better illustrate my problem.</p>
  
  <p>HTML</p>
  
  <pre><code>WBC: &lt;input size="6" id="WBC" name="index"&gt;
  RBC: &lt;input size="6" id="RBC" name="index"&gt;
  HB: &lt;input size="6" id="HB" name="index"&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;label id="__partType100"&gt;&lt;input id="partType100" name="partType" type="checkbox"&gt; NORMAL  &lt;/label&gt; &lt;br&gt;
  &lt;label id="__partType101"&gt;&lt;input id="partType101" name="partType" type="checkbox"&gt; NORMOCYTIC &lt;/label&gt;&lt;br&gt;
  &lt;label id="__partType102"&gt;&lt;input id="partType102" name="partType" type="checkbox"&gt;  MICROCYTIC &lt;/label&gt; &lt;br&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;label id="_partType150"&gt;&lt;input id="partType150" name="partType" type="checkbox"&gt; NORMAL WBC, N&amp;gt;L&amp;gt;M &lt;/label&gt; &lt;br&gt;
  &lt;label id="_partType151"&gt;&lt;input id="partType151" name="partType" type="checkbox"&gt; NORMAL BABY, L&amp;gt;N&amp;gt;M &lt;/label&gt; &lt;br&gt;
  &lt;label id="_partType152"&gt;&lt;input id="partType152" name="partType" type="checkbox"&gt; MILD &amp;#8595;, N&amp;gt;L&amp;gt;M &lt;/label&gt; &lt;br&gt;
  </code></pre>
  
  <p>After inputting some values in the input boxes, the user will click a checkbox from the top set and the bottom set. This will generate some text in a text area. I have a working script that modifies the rendered text, based on a series of if/else conditions from the input fields as follows:</p>
  
  <p>SCRIPT</p>
  
  <pre><code>function testAndFill(){
      if (chosenSite !== null){   
              // conditional arguments based on user inputs               
  
              var wbcIx = $('#WBC').val();
              var rbcIx = $('#RBC').val();
                  if(wbcIx &lt; 3.59 &amp;&amp; rbcIx &lt; 4 ){
                  mytextbox.value += partTypes[chosenSite.id].replace(/Leukocytes are (normal|increased)/,"Leukocytes are decreased").replace(/The red cells are (normal|increased)/,"The red cells are decreased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if(wbcIx &lt; 3.59 &amp;&amp; (rbcIx &gt; 4 &amp;&amp; rbcIx &lt; 5.91)){
                  mytextbox.value += partTypes[chosenSite.id].replace(/Leukocytes are (normal|increased)/,"Leukocytes are decreased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if(wbcIx &lt; 3.59 &amp;&amp; rbcIx &gt; 5.91 ){
                  mytextbox.value += partTypes[chosenSite.id].replace(/Leukocytes are (normal|increased)/,"Leukocytes are decreased").replace(/The red cells are (normal|decreased)/,"The red cells are increased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if((wbcIx &gt; 3.59 &amp;&amp; wbcIx &lt; 11.1) &amp;&amp; rbcIx &lt; 4 ){
                  mytextbox.value += partTypes[chosenSite.id].replace(/The red cells are (normal|increased)/,"The red cells are decreased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if((wbcIx &gt; 3.59 &amp;&amp; wbcIx &lt; 11.1) &amp;&amp; rbcIx &gt; 5.91 ){
                  mytextbox.value += partTypes[chosenSite.id].replace(/The red cells are (normal|decreased)/,"The red cells are increased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if(wbcIx &gt; 15.1 &amp;&amp; rbcIx &lt; 4 ){
                  mytextbox.value += partTypes[chosenSite.id].replace(/Leukocytes are (normal|decreased)/,"Leukocytes are increased").replace(/The red cells are (normal|increased)/,"The red cells are decreased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if(wbcIx &gt; 15.1 &amp;&amp; (rbcIx &gt; 4 &amp;&amp; rbcIx &lt; 5.91)){
                  mytextbox.value += partTypes[chosenSite.id].replace(/Leukocytes are (normal|decreased)/,"Leukocytes are increased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else if(wbcIx &gt; 15.1 &amp;&amp; rbcIx &gt; 5.91 ){
                  mytextbox.value += partTypes[chosenSite.id].replace(/Leukocytes are (normal|decreased)/,"Leukocytes are increased").replace(/The red cells are (normal|decreased)/,"The red cells are increased");
                    //  resets the radio box values after output is displayed
                  chosenSite.checked = false;
                  // resets these variables to the null state
                 chosenSite = null;
                  }
                  else {
                  mytextbox.value += partTypes[chosenSite.id] + "";
                         // resets the radio box values after output is displayed
                      chosenSite.checked = false;
                      // resets these variables to the null state
                     chosenSite = null;
                      }
          }       
          if (chosenDiagnosis !== null){
          mytextbox.value += dxLines[chosenDiagnosis.id] + "";
          // resets the radio box values after output is displayed
          chosenDiagnosis.checked = false;
          // resets these variables to the null state
          chosenDiagnosis = null;
          }
      };
  </code></pre>
  
  <p>Admittedly, this is a rather brute force way to combine the various patterns from two of the three input boxes into a series of if/else statements, but it works. If I wanted to include the third input box however, the coding would be very tedious. </p>
  
  <p>But, I'm limited by what I've learned so far with javascript - so any advice on how to better organize or rethink this if/else logic would be appreciated. Here is a fiddle that shows a simplified version of my site with the above if/else statements: <a href="http://jsfiddle.net/GzVu3/" rel="nofollow">http://jsfiddle.net/GzVu3/</a></p>