How to insert numbers rather than option type into a textbox
<p>I need helping appending values into a textbox. What happens is that with the relevant piece of code below, the user can add an "Option Type" from a table row into the textbox. For example if the user clicks on the "Add" button and within that row the Option Type is "A-D", it adds "A-D" in the textbox. But I don't want it to add "A-D" into the textbox. I want it to add a number with the textbox instead except for "True or False" and "Yes or No" options, they can be inserted as they are. The numbers for each option type is as follows:</p>

<pre><code>Option Type             Number

A-C                     3
A-D                     4
A-E                     5
A-F                     6

...

A-Z                     26
True or False           True or False
Yes or No               Yes or No
</code></pre>

<p>My question is how can insert the numbers for all letter option types (True or False and Yes or No remain the same) into the textbox?</p>

<p>Below is the relevant code where it inserts the option type from the table row into the textbox:</p>

<p>Table row and add button:</p>

<pre><code>      echo "&lt;table border='1' id='resulttbl'&gt;
      &lt;tr&gt;
      &lt;th class='optiontypeth'&gt;Option Type&lt;/th&gt;
      &lt;/tr&gt;";
      foreach ($searchResults as $key=&gt;$question) {
        echo '&lt;td class="optiontypetd"&gt;'.htmlspecialchars($searchOption[$key]).'&lt;/td&gt;';
        echo "&lt;td class='addtd'&gt;&lt;button type='button' class='add' onclick=\"parent.addwindow('$searchOption[$key]');\"&gt;Add&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;";
}
      echo "&lt;/table&gt;";
</code></pre>

<p>Below is the textbox the option types are currently inserted into:</p>

<pre><code>&lt;input type="text" name="gridValues" class="gridTxt maxRow" id="mainGridTxt" readonly="readonly" /&gt;
</code></pre>

<p>Below is the function where it currently inserts the option type into the textbox above:</p>

<pre><code>function addwindow(gridValues) { 

    if(window.console) console.log();

    if($(plusbutton_clicked).attr('id')=='mainPlusbutton') { 
        $('#mainGridTxt').val(gridValues);  
        } 

    $.modal.close(); 
    return false;
}
</code></pre>
