[AccessD] OT-ASP OnChange To Call A Function

paul.hartland at fsmail.net paul.hartland at fsmail.net
Fri May 14 10:26:51 CDT 2004


To all,
 
I’m a bit new to ASP/HTML and currently working with dropdown boxes, however I’m a bit confused on how to pass the selected text to a function.  My code snippet for the dropdown box and function are below:
 
response.write "<SELECT Name='ddOffices' OnChange='OfficeSelected(this.selectedindex.text)'>"
response.write "<OPTION Selected=""Selected"" Value="""">Choose....</OPTION>"
                                    
While Not rsData.EOF
            response.write "<OPTION>" & rsData.Fields("OfficeName") & "</OPTION>"
            rsData.MoveNext
Wend
 
<%
            ' Function just to display name of the office selected.
            Function OfficeSelected(strSelectedOffice)
                        response.write strSelectedOffice
            End Function
%>
 
The problem occurs when I select an item from the dropdown box, I get the following error:
 
this.selectedindex.text Is Null or not an object
 
Can anyone point me in the right direction on what I’m doing wrong.
 
Thanks in advance for any help on this.
 
Paul Hartland

-- 

Whatever you Wanadoo:
http://www.wanadoo.co.uk/time/

This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm


More information about the AccessD mailing list