View the source of the HTML in the browser, and confirm that the right values
are present for each option. In other words, make sure that you have:
FeatId
Parcel
Area
and not:
Feature ID
Parcel
Area
Regardless of this, try:
alert(propertySelect[propertySelect.selectedIndex].name)
Tom
--
in the Html source there is an option values for this layerproperties.
trtdProperty:/td/tr
tr
td class=RegText
select size=1 class=Ctrl id=propertySelect
onChange=OnPropertyChange() style=width: 100%
/select
Is the problem here in your OnLayerChange() function:
propertySelect.options[i] = new Option(properties[i].name, i, false, false);
You are just passing in the variable i as the value, not the proper value. I
don't know if it is as simple as replacing this line with:
propertySelect.options[i] =
Instead of your:
alert(propertySelect.value); [it comes as the index value]
try:
alert(propertySelect[propertySelect.selectedIndex].value);
Does that fix it? This is a Javascript issue, not a PHP one.
Tom
--
View this message in context:
Hi,
Thats what iam asking for php code
After the layername dropdown list box there is some php code for setting
the selected dropdown list
select size=1 class=Ctrl id=layerSelect onChange=OnLayerChange()
style=width: 100%
?php
$selected = 'selected';
foreach($layerNames as $layerName =
Perhaps view the source of the page, and post that here, just to make sure
the right values are populating the form select drop-downs.
Tom
--
View this message in context:
http://n2.nabble.com/Layer-properties-problem-tp4863462p4864331.html
Sent from the MapGuide Users mailing list archive at
Is there a missing close PHP tag?:
select size=1 class=Ctrl id=layerSelect onChange=OnLayerChange()
style=width: 100%
?php
$selected = 'selected';
foreach($layerNames as $layerName = $layerLabel)
{
? !-- Was this close tag missing? --
option value=?= $layerName ? ?=$selected ? ?=
To get back to your original question, from what I can see, your code will
set every option as selected. But which item do you want to be selected?
That list is generated before any user interaction, so which option should
be selected? Once the user chooses one option, you can get at it via:
Hi,
Thanks for your reply.
in propertySelect dropdown list i have the properties like
FeatId,Parcel,Area etc.
by putting
alert(propertySelect[propertySelectselectedIndex].value) as told by your
prev mail it gives me the numerical value of the selected index(for ex if i