on 10-07-2010 7:06 AM
Hi,
I have to read the text of the selected item of the DDlist into another text field.
e.g. The DDlist which has values like
Key text
01 Text01
02 Text02
etc.
And after selecteting the value in DDlist, I refresh the form and in another text field TXfld I want to populate the text from the DDlist. So in the Form:ready event of the TXfld I tried to access it by 'value' and not 'rawValue'
this.rawValue = data.Page1.<subform>.DDlist.value
But I am getting some wierd values like Object26354.
I need some pointers to read the Text of the selected item either with Formcalc or JS.
I tried to search this forum and also google, but did not get anything.
Thanks
~Amit.
Well get the rawValue of dropdown n the exit event of the drop-down and set the rawValue of TextField there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Chintan
Not necessarily. There is a setting on the drop-downs to tell it "when" you want the new value to be assigned. Typically, yes, using the "exit" event is safest, but it can also happen in "on change". Check the attribute on the drop-down to determine how it is assigned.
Ok, that said...
RawValue = the actual selected VALUE from the drop-down list
FormattedValue = the displayed text of the selection from the drop-down list
The second one there (FormattedValue) is actually why there is a BUG with SAP's provided ISR controls. They have code that says "when the user picks something new in the drop-down, take that FormattedValue and find which value it corespons to and then assign that as our selected value". The problem is that if you have entries in your drop-down with the same text, it will ALWAYS pick the first one (and, yes, clients/customers many times use the same texts with their "help values" because in the SAP GUI they can see the "code"/value associated with them and know which to pick.). This is why I almost always write my own generic services now to populate drop-downs so I am sure they have unique display values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrew
Huh? I am not following there. I don't think I suggested using a GS for anything (unless you mean having UNIQUE displayed names in the drop downs....and the only reason I do that is wonder-of-wonders, several/most clients want to see the "code" and the text in the drop down.....so I make it nice for them). But yes, you can easily change the drop-down code to fix the bug (keeping in mind you will have to check/change it for each drop-down you use).....BUT make sure you explain it as others that come behind you or others using "standard" drop-downs won't know what to fix or that the problem actually exists. The BUG is not in the atual "include" JS library script but in the ISR controls library SAP provides. Hopefully SAP fixes it soon and it's a non issue.
For the problem you state where you have to change JS every time you drag a control... may I recommend you change the control code in your library? That would limit the change in a single place... instead of every control you add on the screen. haha
Also, I was referring to your generic service reference: "This is why I almost always write my own generic services now to populate drop-downs so I am sure they have unique display values."
What I was trying to say is that creating generic services for every drop down for this single requirement is quite an interesting approach. Considering you could write a single JS function which you can apply to all your dropdowns to concatenate Key and Value... maybe 30 lines of code? But some like it the hard way! haha
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.