Javascript Error: Object expected

Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Javascript Error: Object expected

    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

    jce1975 Guest

  2. Similar Questions and Discussions

    1. object expected error - audioLoadingStart( )
      Trying to play a swf in a web page using flash. It plays fine, but throws an IE error. The error is: "A runtime error has occurred. Do you...
    2. New Function gives Object Expected Error
      Hello, This problem has been driving me nuts... I have a set of functions and code which work fine by itself and another function which works...
    3. Error object expected
      hey folks! I'm getting the usual NOOB error object expected. I'm creating a simple box and applying a texture to it: The specific line i get the...
    4. object expected error
      Hi I am having several problems that might be a bug or bad codeing but I cant tell as the error only happens immediatly after I save my working...
    5. IIS ASP Object Expected Error
      John wrote: Should be "Err.Clear". The Number propery is read-only IIRC.
  3. #2

    Default Re: Javascript Error: Object expected

    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.



    blewis Guest

  4. #3

    Default Re: Javascript Error: Object expected

    Well, that explains it! Back to the drawing board ... :brokenheart;
    jce1975 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139