Drop down value selection issue

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
alexamores
Profound User
Posts: 20
Joined: Thu Dec 15, 2011 3:05 pm
First Name: alex
Last Name: amores
Company Name: summit consulting
City: lakeland
State / Province: Florida
Zip / Postal Code: 33802-0988
Country: United States
Contact:

Drop down value selection issue

Post by alexamores »

Drop down values are from a database file. The design is blank option = false so that the first selection value will appear on the drop down list. When the first selection value is pick, it does not return that value to the rpg program. But if the next value or any other selection from the list is pick, that value will be returned. Here is another unexplained behavior. If another selection other than the first is pick first, and then go back to the first selection, that selection will be returned. We came from ver 3.3.4 to now 4.6.4. Any help on how we can resolve to have the first value returned to RPG at anytime is appreciated. Using the blank option = true is not an ideal solution. It should return the first selection anytime.
Scott Klement
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: Drop down value selection issue

Post by Scott Klement »

Can you check and see if perhaps the field bound to your drop-down box's 'value' property is set to 0 or blanks, or some other value that's not in the drop down, when the display file is displayed?

That's what this error sounds like. The 'value' property is used to represent the current value of the field. when the drop-down is first shown, the value property is used to select the currently-shown value on the screen. If the user changes the drop-down, it changes the value to the new choice value selected. when the screen is submitted, the result of the selection is provided via the field bound to the value property.

But, if the value property is set to a value that's not in the "choice values" property, PUI will default to whatever is the first field in the drop-down. If you do not change it, it should not change the contents of the 'value' property, either. So if you select the first item in the drop-down, that's not a change, since PUI is showing it by default -- so the 'value' property is also not changed, even though you selected it. On the other hand, having PUI always change the value property to whatever is currently being shown on the screen isn't correct behavior, either... because if you have an invalid value, but just hit enter (and not select anything) it should not arbitrarily change your value property.

But... if the value property is set correctly, this should be non-issue. It will allow you to select any item (including the first) without any issues.

Let me know if this helps
alexamores
Profound User
Posts: 20
Joined: Thu Dec 15, 2011 3:05 pm
First Name: alex
Last Name: amores
Company Name: summit consulting
City: lakeland
State / Province: Florida
Zip / Postal Code: 33802-0988
Country: United States
Contact:

Re: Drop down value selection issue

Post by alexamores »

Thank you for answering to this question quickly Scott. The value property is a variable which RPG reads after the user hit the accept button. The contents of this variable should be the choice values field that was selected by the user. Yes it is blank when the program is called because that is the natural status of the variable until a selection is made from the drop down.

"But, if the value property is set to a value that's not in the "choice values" property, PUI will default to whatever is the first field in the drop-down. If you do not change it, it should not change the contents of the 'value' property, either. So if you select the first item in the drop-down, that's not a change, since PUI is showing it by default -- so the 'value' property is also not changed, even though you selected it." This is the reason why when the blank option is set to true it works.
I am using Database-Driven Selection so the equivalent property to "choice values" is "choice value field". This is not easy because that value is coming from a file.
My other option is to put a correct default value. But if the user just open the drop down and did not make any selection, that value will be send to the RPG. Not acceptable. Is there a way where I can determine if a selection is made on the drop down and pass it to the RPG program?
Scott Klement
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: Drop down value selection issue

Post by Scott Klement »

alexamores wrote:My other option is to put a correct default value. But if the user just open the drop down and did not make any selection, that value will be send to the RPG. Not acceptable.
Sorry, but isn't this exactly what you're asking PUI to do? You want PUI to assume that whatever choice is the first one alphabetically in your file (since that's what will be the first option in the drop-down) is the default value, and assign it to your value variable automatically?

Or, am I misunderstanding?
alexamores wrote:Is there a way where I can determine if a selection is made on the drop down and pass it to the RPG program?
I suspect you could do this with a little bit of Javascript code... let me look into this...
Scott Klement
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: Drop down value selection issue

Post by Scott Klement »

There's a "set as modified" property in the select box. Try setting that to 'true', and see if it works the way you want it to.
alexamores
Profound User
Posts: 20
Joined: Thu Dec 15, 2011 3:05 pm
First Name: alex
Last Name: amores
Company Name: summit consulting
City: lakeland
State / Province: Florida
Zip / Postal Code: 33802-0988
Country: United States
Contact:

Re: Drop down value selection issue

Post by alexamores »

Thank you Scott for the suggestion. But it does not work on our application because the variable will always have a value even if it was not selected.

Maybe a javascript will help.
Scott Klement
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: Drop down value selection issue

Post by Scott Klement »

That's correct. The value should be set to whatever is currently displayed in the drop-down. Isn't that what you wanted?

If you want to keep the item blank when the user doesn't select anything, wouldn't adding a blank value be ideal for that?

I guess I'm not understanding what you're looking for.
alexamores
Profound User
Posts: 20
Joined: Thu Dec 15, 2011 3:05 pm
First Name: alex
Last Name: amores
Company Name: summit consulting
City: lakeland
State / Province: Florida
Zip / Postal Code: 33802-0988
Country: United States
Contact:

Re: Drop down value selection issue

Post by alexamores »

I am sorry I did not make myself clear. The screen was designed with a check box and a drop down. When the user checked the check box, a drop down of selections pops out. When the user unchecked the check box the drop down disappear.
What we want to happen is when the drop down pop out, the first selection is already showing on top of the list. If enter is press and no selection is made, an error comes out requesting the user to make a selection. Currently even if the first selection is already selected, the error still comes out reminding the user to make a selection. This should not happen because a selection is already made. I am looking for a way to make the error appear only when needed. Thank you for any idea.
Scott Klement
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: Drop down value selection issue

Post by Scott Klement »

So let me see if I understand:

1) You don't want to use the blank option. (Why not?)

2) You want to send a blank value as input to a select box (drop down)

3) You want PUI to show the user the first option in the select box, even though the user has not selected it.

4) If the user doesn't click the select box at all, you want it to return blanks back to the program.

5) If the user does click the select box, you want it to return the value they selected, even if they didn't change anything at all.

Are you sure this is what you want? It seems like this would be confusing for the user to see that the first item is already shown in the select box if it hasn't in actuality been selected at all. The "blank option" has the ability to show any string, so you could set the blank option to say "--Click To Select--" or something that makes it obvious that they need to click it to choose an option. But, showing one of the possible selection options in the drop-down when nothing has been selected seems confusing to me.

Unless, of course, you want that preselected value to be returned to the program (even if the user doesn't click on it.) Then, it would indeed seem intuitive... because the user would be able to visually see that it's already selected, and not click it if he/she doesn't want to change it.

Anyway, at least as it stands right now, you need to do one of these three choices:
1) Use the blank option to force the user to make a selection.
2) Use "set as modified" to force the default (first option in the select box) to be returned.
3) Set your 'value' variable to a valid option in the select box before showing the screen.

If I understood you, above, then the way you're trying to do this is not the way a select box was meant to work, and that's why it doesn't work for you. You could, of course, put in a request for the design to be changed... but we cannot make any promise that the team would agree to change it.
alexamores
Profound User
Posts: 20
Joined: Thu Dec 15, 2011 3:05 pm
First Name: alex
Last Name: amores
Company Name: summit consulting
City: lakeland
State / Province: Florida
Zip / Postal Code: 33802-0988
Country: United States
Contact:

Re: Drop down value selection issue

Post by alexamores »

Thank you Scott for the reply and I forwarded this information to the users. I have a question on the how to identify the value on the drop down. On the subfile we have the "row". How about in a dropdown?
Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest