Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8187925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:43:59+00:00 2026-06-07T02:43:59+00:00

I need helping appending values into a textbox. What happens is that with the

  • 0

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:

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

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?

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

Table row and add button:

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

Below is the textbox the option types are currently inserted into:

<input type="text" name="gridValues" class="gridTxt maxRow" id="mainGridTxt" readonly="readonly" />

Below is the function where it currently inserts the option type into the textbox above:

function addwindow(gridValues) { 

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

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

    $.modal.close(); 
    return false;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:44:00+00:00Added an answer on June 7, 2026 at 2:44 am

    Add a check before you change the value of the input field, something like:

    if( questionText != "True or False" && questionText != "Yes or No" )
    {
       // caution pseudo-code ahead:
       var myNumbers = {};
       myNumbers["A-C"] = "3";
       myNumbers["A-D"] = "4";
       // ...
       myNumbers["A-Z"] = "26";
       questionText = myNumbers[questionText];
    }
    
    $('#mainGridTxt').val(questionText);
    

    There are lots of other ways to go about converting the questionText into the correct number, but I was simply showing the logic for you can accommodate non-T/F or -Y/N responses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks everyone for helping me, that I get this piece of code, but I
I need to add an if/else stament inside a MySQL query but can't get
I need to create a multi-dimensional (nested) hashtable/dictionary so that I can use syntax
I need to reorganize an archaic cvs database so that it can be imported
I need it help with shell script, python script or anything that can do
I need a bit of help; I'm helping a friend port a Delphi app
I need to edit format for JFormatedTextField in a Java program. NetBeans are helping
Need some regular expressions help. So far I have my code working to allow
Need help with a query that I wrote: I have three tables Company id
Hay i need to hand implemeneting a voting system into a model. I've had

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.