I am able to populate the dropdown from rpg (not a database file), and the choices, but I am not able to set the value of the dropdown before display.
That is, if I had a dropdown with Options 1 through 5, I need to have it show Option 3 as the current selection of that dropdown when the panel is first displayed. Nothing I'm doing is working and I see no examples of setting the selection in any of the Samples.
setting the value of a dropdown
-
- Profound User
- Posts: 22
- Joined: Fri Jul 30, 2010 1:37 pm
- First Name: Thomas
- Last Name: Garvey
- Company Name: Unbeaten Path Intl
- Phone: 630-462-3991
- State / Province: Illinois
- Zip / Postal Code: 60188
- Country: United States
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: setting the value of a dropdown
What you need to do is bind a field to the "value" property. Have this match the "choices value" that you want to set as the "set value".
Since you say there are no examples, I'll provide one here. Here's the DDS:
Here's the RPG code:
When you run this, you'll see that "YELLOW" comes up as the default choice, because the VALUE field is set to Y. Even though "Red" is first in the list, Yellow is the value because of the Y in the "value" property.
Since you say there are no examples, I'll provide one here. Here's the DDS:
Code: Select all
A INDARA
A R REC
A 1 2HTML('QPUIREC0 ')
A 1 3HTML('{"screen":{"record format nam-
A e":"rec"},"items":[{"id":"Dropdown1-
A ","field type":"select box","value"-
A :{"fieldName":"value","dataLength":-
A "10","trimLeading":"false","trimTra-
A iling":"true","blankFill":"false","-
A rjZeroFill":"false","dataType":"cha-
A r","formatting":"Text","textTransfo-
A rm":"none","designValue":"[value]"}-
A ,"left":"58px","top":"33px","choice-
A s":{"fieldName":"choices","dataLeng-
A th":"100","trimLeading":"false","tr-
A imTrailing":"true","blankFill":"fal-
A se","rjZeroFill":"false","dataType"-
A :"char","formatting":"Text","textTr-
A ansform":"none"},"width":"173px","c-
A hoice values":{"fieldName":"values"-
A ,"dataLength":"100","trimLeading":"-
A false","trimTrailing":"true","blank-
A Fill":"false","rjZeroFill":"false",-
A "dataType":"char","formatting":"Tex-
A t","textTransform":"none"}},{"id":"-
A Button1","field type":"button","css-
A class":"button","value":"Ok","left-
A ":"26px","top":"104px","width":"100-
A px","cursor":"default","response":{-
A "fieldName":"btnOkay","customTrue":-
A "","customFalse":"","dataType":"ind-
A icator","formatting":"Indicator","i-
A ndFormat":"1 / 0"}},{"id":"Button2"-
A ,"field type":"button","css class":-
A "button","value":"Exit","left":"150-
A px","top":"104px","width":"100px","-
A cursor":"default","response":{"fiel-
A dName":"btnExit","customTrue":"","c-
A ustomFalse":"","dataType":"indicato-
A r","formatting":"Indicator","indFor-
A mat":"1 / 0"}}]}')
A BTNEXIT 1A H
A BTNOKAY 1A H
A CHOICES 100A H
A VALUE 10A H
A VALUES 100A H
Code: Select all
H DFTACTGRP(*NO)
FDROPVALD CF E WORKSTN EXTDESC('SKTEST/DROPVALD')
F EXTFILE(*EXTDESC)
F HANDLER('PROFOUNDUI(HANDLER)')
/free
choices = 'Red,Blue,Orange,Green,Yellow,Brown,White,Black';
values = 'R,BL,O,G,Y,BR,W,BK';
value = 'Y'; // start with yellow.
dou btnExit = *on;
exfmt rec;
enddo;
*inlr = *on;
-
- Profound User
- Posts: 22
- Joined: Fri Jul 30, 2010 1:37 pm
- First Name: Thomas
- Last Name: Garvey
- Company Name: Unbeaten Path Intl
- Phone: 630-462-3991
- State / Province: Illinois
- Zip / Postal Code: 60188
- Country: United States
- Contact:
Re: setting the value of a dropdown
Thanks, Scott.
Real problem turned out to be the length of the Choices and Choices Values fields. They defaulted to 10, but must be defined long enough to contain all elements, delineated by commas. Also, I was setting the selection based on the Choices (those actually displayed), when it must be set using the Choices values (those used internally).
Real problem turned out to be the length of the Choices and Choices Values fields. They defaulted to 10, but must be defined long enough to contain all elements, delineated by commas. Also, I was setting the selection based on the Choices (those actually displayed), when it must be set using the Choices values (those used internally).
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: setting the value of a dropdown
Yep, you're completely correct there, Thomas.
Who is online
Users browsing this forum: No registered users and 0 guests