Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
User Experience
Lawson Design Studio
Get attributes from listbox?
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Saef
Past 24 Hours:
0
Prev. 24 Hours:
0
Overall:
5226
People Online:
Visitors:
864
Members:
0
Total:
864
Online Now:
New Topics
User Group Announcements
Carolina User Group Meeting
12/20/2024 3:15 PM
Date & Time: February 6, 2025, 8:30am - 4:00pm
S3 Systems Administration
ADFS certificate - new cert
12/3/2024 9:38 PM
The certificates on the windows boxes expired and
Lawson S3 HR/Payroll/Benefits
Post Tax Benefit Plan Table
11/14/2024 9:16 PM
Hi, totally new to Laswon. I have a repor
Lawson S3 Procurement
ED501 Error: Map 850 not supported by /law/c15vda/lawson/test10/edi/bin/laws_out_91
11/12/2024 3:47 PM
Tried runnning ED501 and getting the atathced erro
Lawson S3 HR/Payroll/Benefits
Error
11/6/2024 9:54 PM
When I try to enroll a retiree in 72.1 health plan
Infor ERP (Syteline)
Syteline: New Data Maintenance Wizard (Error) Need help
11/1/2024 4:24 PM
Hi, I need help with an error on syteline while us
Dealing with Lawson / Infor
Implementing Lawson v10 with Cerner Surginet, Case Cart Picking, and Quick Adds for the OR
10/29/2024 4:20 PM
Hi Everyone, I am wondering if there is any org
Lawson S3 HR/Payroll/Benefits
Canada Tax Calculation (Federal and Provincial) Issue
10/23/2024 5:00 AM
Initially, we had problem with CPP2 calculation is
Lawson S3 HR/Payroll/Benefits
CA Section 125 401k Plan
10/22/2024 10:13 PM
Does anyone have any recommendations on how to fac
S3 Systems Administration
Running AC120 deleted records from ACMASTER table
10/22/2024 3:40 PM
We recently ran the AC120 as normal and somehow it
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3291
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1372
Roger French
1315
mark.cook
1244
Forums
Filtered Topics
Unanswered
Unresolved
Announcements
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
User Experience
Lawson Design Studio
Get attributes from listbox?
Please
login
to post a reply.
9 Replies
0
Subscribed to this topic
12 Subscribed to this forum
Sort:
Oldest First
Most Recent First
Author
Messages
George Graham
Veteran Member
Posts: 201
12/22/2011 4:47 AM
I've been trying different options here with no luck. I have a listbox that is loaded with values from a script. This loads three attributes - text, tran and disp.
I'm trying to see how to extract those attributes from the object related to the value selected in the listbox so that I can display it next to the listbox in a label.
For example, I may display a list of employees in the drop down, but what is returned as as the value is the employee number. However, I want to populate a label next to the listbox with the employee name - but I'm trying to do that WITHOUT having to go back to the data using the employee id in the listbox.
David Williams
Veteran Member
Posts: 1127
12/22/2011 9:48 AM
If you can't get the value from the Listbox, you could store the values you're loading into the Listbox into an array variable as well and then look up the name from the values in the array after the Listbox updates. Not the best approach, but it would work.
George Graham
Veteran Member
Posts: 201
12/22/2011 3:47 PM
Understand where you are going David - and my thought was to avoid unnecessary DME calls to populate the related description label. Just thought since those attributes are getting loaded into the object there would have to be a way to reference them - but maybe not if they are only used in the display for the drop down logic...?
jamesraceson
Veteran Member
Posts: 52
12/22/2011 4:07 PM
George,
With David's idea there would not be any unnecessary DME calls. We are currently using the same exact idea. Like David said, it's really not the best approach, but it works great. When you populate the Listbox you would also at the same exact time populate an array with the values that you want. Then when the user selects the value from the Listbox (let's say Employee Id) you would only have to find the match in the array (Employee Id) and populate your description label with any associated value you want from the array (say Employee First name). This way no extra DME calls would have to made and it would process very quickly as well (no excessive hang time after selecting value from Listbox).
David Williams
Veteran Member
Posts: 1127
12/22/2011 4:16 PM
Vindication!
I assumed the ListBox was being populated from a DME getting all of the values so what James said is true. If you load the values into the array then you don't have to do another DME to get the name again.
George Graham
Veteran Member
Posts: 201
12/22/2011 4:45 PM
I'm not disagreeing that it is an effective work around - just seems redundant given that those values ARE attributes in the object - SOMEWHERE...
jamesraceson
Veteran Member
Posts: 52
12/22/2011 4:59 PM
While definately true (the values out there somewhere), the effective work around will probably be quicker, effective, and will not sacrifice any speed nor validity of the information retrieved.
If you still would like to find where the values are, you can get them through the page's DOM. Depending on what approach you use (either manual or using a browser tool) depends on how long it will take to find the object containing the list values you are looking for. More then likely it will be buried within numerous frames and/or documents and you might have to reference it in the script through several object variables (specifically for ease of following code since the reference string could be very long if put into just one).
Robert Spurr
Veteran Member
Posts: 130
12/23/2011 2:15 PM
I think this is what you are looking for, I slapped a listbox onto a form and then tried to retrieve the attributes of the SPAN. The code includes loading the listbox and than retrieving a value. Of course this is just a sample and would need to be refined for you purpose but it is a starting point
function FORM_OnAfterDataInit()
{
//
//Variables to load listboxs
//
var Load01 = document.getElementById("VALUES_l75");
var ListVal1;
//
//Fill List Box
//
ListVal1 = document.createElement("span");
ListVal1.setAttribute("text","e1234");
ListVal1.setAttribute("tran","Robert");
ListVal1.setAttribute("disp","employee");
Load01.appendChild(ListVal1);
ListVal1 = document.createElement("span");
ListVal1.setAttribute("text","e1235");
ListVal1.setAttribute("tran","Roberte");
ListVal1.setAttribute("disp","employees");
Load01.appendChild(ListVal1);
ListVal1 = document.createElement("span");
ListVal1.setAttribute("text","e1235");
ListVal1.setAttribute("tran","Robertee");
ListVal1.setAttribute("disp","employeess");
Load01.appendChild(ListVal1);
//This is the important part
var vTest = document.getElementById("VALUES_l75");
alert(vTest.childNodes[1].getAttribute("tran"));
//End important part
//var vHold = "";
//for(var i=0;i
//{
// if(vTest.childNodes
.nodeName != " " && vTest.childNodes
.nodeValue != "null")
// {
// vHold += vTest.childNodes
.nodeName + " - " + vTest.childNodes
.nodeValue + "\r";
// //alert(vTest.attributes.item(i).name);
// }
//}
//alert(vHold);
}
David Williams
Veteran Member
Posts: 1127
12/28/2011 11:43 AM
Okay try this:
//**
function FORM_OnInit()
{
var rcList = document.getElementById("VALUES_l68") // _l68 is the Field Nbr of my ListBox
var span = document.createElement("span");
while(rcList.hasChildNodes())
{
rcList.removeChild(rcList.childNodes.item(0)) // Remove it
}
span.setAttribute("text","David Williams"); // long desc
span.setAttribute("tran","David Williams"); // transaction value
span.setAttribute("disp","123456"); // display value
rcList.appendChild(span);
var span = document.createElement("span");
span.setAttribute("text","Marian Helen")
span.setAttribute("tran","Marian Helen")
span.setAttribute("disp","987654")
rcList.appendChild(span);
}
function VALUES_OnBlur(id, row)
{
lawForm.setFormValue("text65",lawForm.getDataValueById("select1",1))
return true;
}
**//
Bill Alt
Advanced Member
Posts: 25
11/15/2016 12:55 AM
I tried this and am getting this error.
Unable to get property 'appendChild' of undefined or null reference
Here is my code. And I am getting data from my DME query.
function FORM_OnAfterDataInit()
{
var strPDL = portalWnd.oUserProfile.getAttribute("productline");
var s = "?PROD="+strPDL;
s += "&FILE=EMPLOYEE&INDEX=EMPSET1&KEY=10&SELECT=SEC-LVL=2";
s += "&FIELD=EMPLOYEE;LAST-NAME;FIRST-NAME";
s += "&OUT=XML&MAX=200";
var sReturn = portalWnd.httpRequest(portalWnd.DMEPath + s)
var vObjDMEXML = new portalWnd.DataStorage(sReturn);
var vRecord = vObjDMEXML.document.getElementsByTagName("RECORD");
//
//Variables defined to fill listbox
//
var Level1List = document.getElementById("VALUES_l27");
var ListVal;
ListVal = document.createElement("span");
for (var ix=0; ix < vRecord.length - 1 ; ix++)
{
var vCols = vRecord[ix].getElementsByTagName("COL");
var str = vCols[0].firstChild.data;
var str1 = vCols[1].firstChild.data;
var str2 = vCols[2].firstChild.data;
var str3 = str1 + ' ' + str2;
alert('str ' + str);
alert('str1 ' + str1);
alert('str2 ' + str2);
alert('str3 ' + str3);
ListVal.setAttribute("tran",str);
ListVal.setAttribute("text",str1);
ListVal.setAttribute("disp",str3);
alert('Maybe disp?');
Level1List.appendChild(ListVal);
}
}
Please
login
to post a reply.