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 8561855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:35:54+00:00 2026-06-11T16:35:54+00:00

I am reposting this question with revised code that use more of jQuery. Here

  • 0

I am reposting this question with revised code that use more of jQuery.

Here is the HTML code that defines the objects:

<LEGEND><b>Select Study Sample</b></LEGEND>
<p>
<P CLASS=select_header>Study - Box - Well - Lab ID<br>
<SELECT multiple size=20 NAME="stylabid" ID="stylabid" onchange=show_stylabid() onclick=clear_fetch() STYLE="width: 115px">
<?php 
  $i=0;
  while ($i < $numstylabids) {
    $styarr = pg_fetch_row($stylabidresult);
    echo "<option value=$styarr[0]>$styarr[1]\n";
    $i++;           
  }
  ?>
</select>

and

<LEGEND><b>Select Project Sample</b></LEGEND>
<p>
<P CLASS=select_header>Project - Box - Well - Lab ID<br>
<SELECT multiple size=20 NAME="pjtlabid" ID="pjtlabid" onchange=show_pjtlabid() onclick=clear_fetch() STYLE="width: 115px">
<?php 
  $j=0;
  while ($j < $numpjtlabids) {
    $pjtarr = pg_fetch_row($pjtlabidresult);
    echo "<option value=$pjtarr[0]>$pjtarr[1]\n";
    $j++;           
  }
  ?>
</select>

Now, here is the javascript; I am simply trying to get the values of the selected object, which can be either a Study or a Project. I use this later to retrieve data from the database:

function fetchgenotype() {
    var ms, mndx, ss, sndex = 0;

    ms = $("#marker")[0].selectedIndex;    

    if (Study_selected) {
      ss = $("#stylabid")[0].selectedIndex;
      sndx = $("#stylabid").val(ss);
    } else
      ss = $("#pjtlabid")[0].selectedIndex;
      sndx = $("#pjtlabid").val(ss);
    }    

    // for debugging...    
 alert('ss='+ss+', sndx='+sndx);

This code dies on the line sndx = ... Would really appreciate any help!

TIA

  • 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-11T16:35:55+00:00Added an answer on June 11, 2026 at 4:35 pm

    Currently i don’t know what $(“#marker”) an Study_selected are.

    Assuming there is anything OK so far, change the function into:

    if (Study_selected) {
          sndx = $("#stylabid").val();
        } else
          sndx = $("#pjtlabid").val();
        }
    

    val() returns the value of a form-element when used without an argument, otherwise it will set the value and return an jQuery-object.

    There is no need to retrieve the selectedIndex, you may access the value of the select-element directly(it will be the value of the currently selected option)

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

Sidebar

Related Questions

I am reposting this question due to inability to solve the problem (original here
I realize that this question has been asked and has been answered here but
(I am reposting this question here because I tried on the google news group
This question might not belong here, and since this is related to HTML and
i am reposting this question because alot of people here advised me to repost
Perhaps my last question (now deleted) was misunderstood so I'm reposting it with more
This question has been answered. The problem was that myEventMoveTrainManaul() was being called from
This question has been asked before in a more general way. I want to
This question is language independent. I have an application that handles requests in a
Apologies for reposting but I had to edit this question when I got to

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.