Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Display value in drop down listbox

3 views
Skip to first unread message

priya

unread,
Sep 17, 2003, 10:34:39 AM9/17/03
to
Hi All,
Does anyone know how to get a drop down list box to
display the first value rather than remain blank until a
value from the list is selected??
My drop down listbox is being filled from script..

Thanks in advance
Priya

Stephen Cummins [MVP]

unread,
Sep 18, 2003, 9:19:57 AM9/18/03
to
Could a workaround be to set a default value?
--
Stephen Cummins MVP, MCP
http://www.infopathfaq.com
http://www.spsfaq.com
http://www.imprss.com
----------------------------------------------------------
"priya" <priya_t...@hotmail.com> wrote in message
news:006701c37d28$d31553e0$a101...@phx.gbl...

priya

unread,
Sep 18, 2003, 11:20:31 AM9/18/03
to
Hi Stephen,

Sorry I didn't quite get you. I want to be able to
automatically fill textboxes from the value displayed in
the dropdown. The dropdown is filled on a button click
event. but the list of values only shows when the
dropdown's arrow is clicked..I would just like to know if
it is possible to have the first value in the list
displayed (rather than blank)and accordingly textboxes
filled. Makes things simpler.
Thanks
Priya

>.
>

Perry Faulkner

unread,
Sep 18, 2003, 5:09:01 PM9/18/03
to
Hi Priya,

If you're setting the values in script, can't you just
set the first one as the current value? I think that's
what Stephen is getting at.

Can't remember the attribute, but it's something like:

myDropdown.selectedIndex = 1;

HTH

Perry

>.
>

priya

unread,
Sep 19, 2003, 6:25:59 AM9/19/03
to
Hi Perry,
Thanks for helping. But I tried:

XDocument.DOM.selectSingleNode
("//my:dropdown").selectedIndex=1;

And I get:
Object does not support this property or method.
Any idea??
Thanks
Priya

>.
>

Andrew Watt

unread,
Sep 19, 2003, 7:34:00 AM9/19/03
to
On Fri, 19 Sep 2003 03:25:59 -0700, "priya"
<priya_t...@hotmail.com> wrote:

>Hi Perry,
>Thanks for helping. But I tried:
>
>XDocument.DOM.selectSingleNode
>("//my:dropdown").selectedIndex=1;
>
>And I get:
>Object does not support this property or method.
>Any idea??
>Thanks
>Priya

Priya,

Try

XDocument.DOM.selectSingleNode("//my:dropdown[position()=1]")

or

XDocument.DOM.selectSingleNode("//my:dropdown[1]")

Andrew Watt
http://groups.yahoo.com/group/infopath/
http://groups.yahoo.com/group/xforms/

Joel Alley [MSFT]

unread,
Sep 19, 2003, 11:25:21 AM9/19/03
to
The dropdown listbox will not show a value until either the user selects
one or you set one programmatically. If you're getting you're filling your
listbox choices through script, then simply set the listbox value through
script as well. For example, the following script queries a secondary data
source to get a list of choices used by a dropdown listbox, and then sets
the value of the list box to the first choice returned by the secondary
data source.

'Get a reference to the field we want to use as a key for the Web service
Dim fieldValue
set fieldValue = XDocument.DOM.selectSingleNode(
"/my:TwoDropDowns/my:DropDown1" )

'Get a reference to the SDS bound to the Web Service
Dim theDataObject
set theDataObject = XDocument.DataObjects.Item("GetFruitList")

'Set the SelectionNamesplaces so we can find the proper field
theDataObject.DOM.setProperty"SelectionNamespaces", _

"xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion"" xmlns:s0=""http://tempuri.org/"""

Dim queryValue
set queryValue = theDataObject.DOM.selectSingleNode( _
"/dfs:myFields/dfs:queryFields/s0:GetFruitList/s0:FruitIndex" )

queryValue.text = fieldValue.text
theDataObject.Query

'Set the value of the second dropdown
XDocument.DOM.selectSingleNode("/my:TwoDropDowns/my:DropDown2").text = _
theDataObject.DOM.selectSingleNode
"/dfs:myFields/dfs:dataFields/s0:GetFruitListResponse/s0:Fruit[0]/s0:Value"

XDocument.View.ForceUpdate


Thanks,
Joel Alley,MCSD

Bogdan Dragos HALCIUG

unread,
Sep 19, 2003, 6:08:32 PM9/19/03
to
I just found a simplier way to do the same thing ...

function XDocument::OnLoad(eventObj) // or you can use OnSwitchView()
{
var dom = XDocument.DOM;
// choose the first node from your repetitive data source
var firstNODE =
GetDOM("TheNameOfYourSecondaryDataSource").selectNodes("//Table").item(0).te
xt;
dom.selectSingleNode("//my:DropDownValue").text = firstNODE;
}

--
Bogdan HALCIUG
R&D Developer
L.I.M.S. (USA) INC.
Phone: (954) 964-8663 ext. 33
Fax: (954) 964-8113
bog...@starlims.com
Web: www.starlims.com

""Joel Alley [MSFT]"" <joe...@online.microsoft.com> wrote in message
news:eap0AJsf...@cpmsftngxa06.phx.gbl...

0 new messages