Print Page | Close Window

drop-down list - read all elements

Printed From: Forum openElement
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: http://forum.openelement.com/fr/forum_posts.asp?TID=1501
Printed Date: 26 Mai 2019 at 06:54
Software Version: Web Wiz Forums 10.11 - http://www.webwizforums.com


Topic: drop-down list - read all elements
Posted By: uzes90
Subject: drop-down list - read all elements
Date Posted: 06 Avr 2019 at 04:02

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 10.11 - http://www.webwizforums.com
Copyright ©2001-2012 Web Wiz Ltd. - http://www.webwiz.co.uk