Object doesn't support this property or method 
Author Message
 Object doesn't support this property or method

I'm creating an HTA form that has an array of three option buttons. I want
to retrieve the value of the selected option button but cannot. I've tried
using name.value, name.checked(or selected), name.checked(or
selected).value, name.tabindex.value,  name.tabindex().checked, etc. and
nothing seems to work.

Which one am I missing to make this work?  I can reference a drop down list
no problem through its name.value property, but I'd rather use the option
buttons.

TIA

Jon



Tue, 03 May 2005 21:44:19 GMT  
 Object doesn't support this property or method
Here is an hta (Scriptlister.hta) which shows how to handle multiple
checkboxes:
   http://www3.sympatico.ca/mitchg/wsh/ScriptLister.hta
 - Mitch
Quote:

> I'm creating an HTA form that has an array of three option buttons. I want
> to retrieve the value of the selected option button but cannot. I've tried
> using name.value, name.checked(or selected), name.checked(or
> selected).value, name.tabindex.value,  name.tabindex().checked, etc. and
> nothing seems to work.

> Which one am I missing to make this work?  I can reference a drop down list
> no problem through its name.value property, but I'd rather use the option
> buttons.

> TIA

> Jon



Tue, 03 May 2005 23:16:39 GMT  
 Object doesn't support this property or method

Quote:

> I'm creating an HTA form that has an array of three option buttons. I
> want to retrieve the value of the selected option button but cannot.
> I've tried using name.value, name.checked(or selected),
> name.checked(or selected).value, name.tabindex.value,
> name.tabindex().checked, etc. and nothing seems to work.

> Which one am I missing to make this work?  I can reference a drop
> down list no problem through its name.value property, but I'd rather
> use the option buttons.

Radio buttons with the same name form a collection (HTMLElementCollection to
be precise).  It can be enumerated with For Each x In y syntax and can also
be indexed using it's 1-based .Count property and 0-based .Item(index)
property.

<html>
<head>
<script language='VBScript'>

sub GetOption()

  set opts = myform.myOpt
  set selOpt = nothing

  for each opt in opts
    if opt.checked then
      set selOpt = opt : exit for
    end if
  next
  if selOpt is nothing then
    msgbox "no option selected"
    exit sub
  end if

  msgbox "you selected option value=" & selOpt.value

end sub

</script>
<body>
<form name=myform>
  <input type=radio name=myOpt value="a"> Option A<br>
  <input type=radio name=myOpt value="b"> Option B<br>
  <input type=radio name=myOpt value="c"> Option C<br>
  <input type=button name=myBtn value="Get Option"
    onclick='GetOption'>

</body>
</html>

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US



Tue, 03 May 2005 23:21:37 GMT  
 Object doesn't support this property or method
oMaxfiles.options(oMaxfiles.selectedIndex).text
 ....

<SELECT ID="oMaxfiles" onchange="setmaxfiles()">
 <OPTION VALUE=1>100
 <OPTION VALUE=2 SELECTED>250
 <OPTION VALUE=3 >500
 <OPTION VALUE=4 >1000
 <OPTION VALUE=5>All
</SELECT>

 - Michel Gallant
   MVP Security
   http://home.istar.ca/~neutron

Quote:

> I'm creating an HTA form that has an array of three option buttons. I want
> to retrieve the value of the selected option button but cannot. I've tried
> using name.value, name.checked(or selected), name.checked(or
> selected).value, name.tabindex.value,  name.tabindex().checked, etc. and
> nothing seems to work.

> Which one am I missing to make this work?  I can reference a drop down list
> no problem through its name.value property, but I'd rather use the option
> buttons.

> TIA

> Jon



Tue, 03 May 2005 23:07:51 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Object doesn't support this property or method : 'DTSGlobalVariables(...).Value.Open

2. Object doesn't support this property or method

3. Object doesn't support this property or method

4. Object doesn't support this property or method

5. Object doesn't support this property or method

6. Sample code: Object doesn't support this property or method

7. Object doesn't support this property or method

8. Object doesn't support this property or method

9. ASP Error on Session.Contents : Object doesn't support this property or method

10. Object doesn't support this property or method

11. Help!- 438- Object doesn't support this property or method

12. Object doesn't support this property or method

 

 
Powered by phpBB® Forum Software