Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: wwWebDropDownList text vs value

$
0
0
Re: wwWebDropDownList text vs value
Web Connection 5.0
Re: wwWebDropDownList text vs value
04/18/2012
05:40:54 AM
3HD0C6IBD Show this entire thread in new window
Gratar Image based on email address
From:
Bob Roenigk
To:
Attachments:
None
I am surprised this worked for you. 'Value' is misspelled in the 4th line. :) But after that correction, the text is now appearing in the dropdown box as expected. All is well.

Thank you.

~bob


Hmm... it works for me, but it's once again possible I sent you some code before it was quite ready for showtime :-)

I changed the way lists work to actually store list items rather than using only key and value pairs for value and text to make things more consistent for all types of lists. So now DropDownList/ListBox/RadioButtonList all use the exact same item container mechanism.

In the process of that change some of hte rendering logic changed. It's an easy fix once again. I apologize, but it's one of those things when you work with unreleased code.

Here's the update in wwWebListControl::Render():

*** add any items manually added FOR lnX = 1 TO THIS.Items.Count loItem = this.Items.aItems(lnX,2) lcText = loItem.Text lcValue = loItem.Vaue IF VARTYPE(lcValue) # "C" lcValue = lcText ENDIF IF llSingleMode IF this.SelectedValue == lcValue lcOutput = lcOutput + [<option value="] + this.WriteEncodedAttributeString(lcValue) + [" selected="selected">] + lcText + [</option>] + CRLF ELSE lcOutput = lcOutput + [<option value="] + this.WriteEncodedAttributeString(lcValue) + [">] + lcText + [</option>] + CRLF ENDIF ELSE IF "|" + lcValue + "|" $ lcSelectedValues lcOutput = lcOutput + [<option value="] + this.WriteEncodedAttributeString(lcValue) + [" selected="selected">] + lcText + [</option>] + CRLF ELSE lcOutput = lcOutput + [<option value="] + this.WriteEncodedAttributeString(lcValue) + [">] + lcText + [</option>] + CRLF ENDIF ENDIF ENDFOR

Previously this code just retrieve value/string directly instead of the item.

Hope this helps,

+++ Rick ---

+++ Rick ---


Rick,

After updating the server with the new Dispose() and Clear() magic, a client informed me a dropdown that was displaying text options is now only showing the numeric values. Perhaps this is a coincidental timing, but I know this was working as expected two days ago.

Here is the script.

<ww:wwWebDropDownList ID="cboUPSModel" runat="server"> <asp:ListItem Value="1">test1</asp:ListItem> <asp:ListItem Value="2">test2</asp:ListItem> </ww:wwWebDropDownList>

And what was generated.

<select autocomplete="on" id="cboUPSModel" name="cboUPSModel" size="1"> <option value="1">1</option> <option value="2">2</option> </select>

I also populated the values in the code behind, but had the same result. No text in the dropdown.

I seem to remember something about some sort of idiosyncrasy in dropdowns long ago, but could not find anything here in the archives.

~bob




Viewing all articles
Browse latest Browse all 10393

Trending Articles