Print Page | Close Window

drop-down list - read all elements

Printed From: openElement Website
Category:

openElement


Forum Name: User Tutorials
Forum Description: Browse or create a tutorial to get the most out of the openElement software.
Please do not post support questions in this section.
URL: https://forums.openelement.uk/en/forum_posts.asp?TID=1501
Printed Date: Apr 19 2024 at 10:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: drop-down list - read all elements
Posted By: uzes90
Subject: drop-down list - read all elements
Date Posted: Apr 06 2019 at 3:02am

All,

I just spent a few days trying to read all of the elements in a drop-down list. This all went in a code-block, and it was a real pain. Ce n’était pas évident.

Here’s what I came up with, I’m sure it’s not perfect but it works.  The examples I found on the web just didn’t work.

  1. Gotta always use element ID’s and no names
  2. It helped using a “ptr” variable.
  3. Figuring out the structure was a real pain. The “automatic prototypes” helped but were not all inclusive.
  4. Figuring out the final “next()” made my day.

Enjoy,.

-uzes90


function getDropDownData(){
    var ddlArray= new Array();
// get number of entries. Should be: ddl.option.length
    var listboxOptionsPtr = $('#WE4758bd185f option');
    var listboxCount = listboxOptionsPtr.length;
        for (i = 0; i < listboxCount; i++) { 
            ddlArray = listboxOptionsPtr.val();
           listboxOptionsPtr = listboxOptionsPtr.next();
       }
}



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net