Javascript Error: Object expected

Posted: 03-02-2005, 09:36 PM
I am having a very difficult time trying to get one drop down to call a
cffunction and return a value to select the second drop down. I am getting a
javascript error, 'Object expected.' I have highlighted the line which is
giving me the error: <cfif isdefined('url.uid')> <!--- Get the user's
personal information from the database. ---> <cfquery name='getUserInfo'
dbtype='query'> SELECT * FROM getUser WHERE uid = #url.uid# </cfquery>
<cfelse> <!--- Set Default User Parameters ---> <cfparam
name='getUserInfo.Uid' default=''> <cfparam name='getUserInfo.firstname'
default=''> <cfparam name='getUserInfo.midname' default=''> <cfparam
name='getUserInfo.lastname' default=''> <cfparam name='getUserInfo.phone'
default=''> <cfparam name='getUserInfo.email' default=''> <cfparam
name='getUserInfo.title' default=''> <cfparam name='getUserInfo.category'
default=''> <cfparam name='getUserInfo.subcategory' default=''> <cfparam
name='getUserInfo.Userid' default=''> <cfparam name='getUserInfo.Password'
default=''> <cfparam name='getUserInfo.center' default=''> <cfparam
name='getUserInfo.Role' default=''> <cfparam name='getUserInfo.ActiveStatusID'
default='1'> </cfif> <cffunction name='findSubCategory' returntype='string'>
<cfargument name='categoryID' type='integer' required='true'> <cfargument
name='dsn' type='string' required='true'> <cfquery name='getSubCat'
datasource='#dsn#'> SELECT * FROM SubCategories WHERE CatID =
#categoryID# ORDER BY SubCatID </cfquery> <cfreturn
getSubCat.SubCategory> </cffunction> <cfform action='user_administration.cfm'
method='POST' name='form1'> <table> <!--- some other form fields ---> <tr>
<cfquery datasource='#dsn#' name='Getcategory'> Select * from categories
order by catid </cfquery> <td class='r' id='Category'><img
src='images/requiredicon.gif' width='9' height='11' border='0' alt='required
field'>Category:<br></td> <td headers='Category'> <select name='Category'
size='1' tabindex='9'
onChange='findSubCategory(document.form1.Category. options[document.form1.Categor
y.selectedIndex].value, '#dsn#')'> <option></option> <cfloop
query='getcategory'> <option #iif(getcategory.category eq
getuserinfo.category, de('selected'),de(''))#
value='#getcategory.catID#'>#getcategory.category# </option> </cfloop>
</select> </td> </tr> <tr> <cfquery datasource='#dsn#'
name='Getsubcategory'> Select * from subcategories order by subcatid
</cfquery> <td class='r' id='Subcategory'>Subcategory:<br></td> <td
headers='Subcategory'> <select name='Subcategory' size='1' tabindex='9'>
<option></option> <cfif #getsubcategory.subcategory# eq
#getuserinfo.subcategory#> <option #iif(getsubcategory.subcategory eq
getuserinfo.subcategory, de('selected'),de(''))#
value='#getsubcategory.subcategory#'>#getsubcatego ry.subcategory#</option>
<cfelseif isdefined('getSubCat.subcategory')> <cfloop
query='getsubcategory'> <!--- <option #iif(getsubcategory.subcategory eq
getuserinfo.subcategory, de('selected'),de(''))#
value='#getsubcategory.subcategory#'>#getsubcatego ry.subcategory#</option>
---> <option #iif(getsubcategory.subcategory eq getSubCat.subcategory,
de('selected'),de(''))#
value='#getsubcategory.subcatID#'>#getsubcategory. subcategory#</option>
</cfloop> </cfif> </select> </td> </tr> <!--- some other form fields
---> </table> </cfform> :confused; James

Reply With Quote

Responses to "Javascript Error: Object expected"

blewis
Guest
Posts: n/a
 
Re: Javascript Error: Object expected
Posted: 03-02-2005, 10:48 PM
You can't call a CF function from a web form using JavaScript without actually
submitting the form. the CFFUNCTION is server-side, because CF is serer side.
JavaScript is client-side. You are getting an error because th onChange is
looking for a JavaScript function called "findSubCategory" and you have not
defined a JS function called that. As far as JS knows, that function does not
exist.



Reply With Quote
jce1975
Guest
Posts: n/a
 
Re: Javascript Error: Object expected
Posted: 03-03-2005, 01:28 PM
Well, that explains it! Back to the drawing board ... :brokenheart;
Reply With Quote
 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expected a dict. object error message cguerrero@adobeforums.com Adobe Acrobat Macintosh 4 05-02-2005 09:39 PM
execute + ArraySearch causes "Expected end of statement" error - Why? Phil Powell ASP 2 07-10-2003 06:37 AM
Object reference not set to an instance of an object. .......... Error .... Please Help Sean ASP.NET Data Grid Control 2 07-09-2003 02:49 PM
IIS ASP Object Expected Error Bob Barrows ASP Database 0 07-08-2003 11:32 AM
Too few parameters. Expected error THE BIG MAN ASP 3 07-06-2003 04:52 PM