Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8331525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:26:26+00:00 2026-06-09T02:26:26+00:00

After a form submit, javascript function is called. JS checks to see if there

  • 0

After a form submit, javascript function is called. JS checks to see if there is any data entered into the fields. On success, loads this CF page. The page is an ajax load, that is why I’m not using #form.value#.

The query is what is messing me up. I’ve run through the rest of the code multiple times, the only time there is an error is when the itemtitle line is added to the query:

<cfset fieldList = url.searchFields>
<cfset fieldArray = listToArray(fieldList)>
<!--- The fieldArray has the form field names and values in a one-dimensional array
so every odd index is a title and every even index is a value. Hence the step=2 ---
<cfloop index="testing" from="1" to=#ListLen(fieldList)# step="2">
    <cfif fieldArray[testing] is 'searchID'>
        <cfset itemid = fieldArray[testing + 1]>
        <cfoutput>itemid = #itemid#</cfoutput>
    </cfif>
    <cfif fieldArray[testing] is 'searchName'>
        <cfset itemtitle = fieldArray[testing + 1]>
        <cfoutput>itemtitle = #itemtitle#</cfoutput>
    </cfif>
    <cfoutput>#fieldArray[testing]# #fieldArray[testing + 1]#</cfoutput>
</cfloop>

    <cfquery name="searchItems" datasource="#thedb#">
        SELECT *
        FROM spp_items
        WHERE avail_mode LIKE '0' 
        <cfif isDefined('url.categoryID')> AND categoryid = #url.categoryID#</cfif>
        <cfif isDefined('itemid')> AND itemid = #itemid#</cfif>
<!--- if I comment this next line out, the query works fine --->
        <cfif isDefined('itemtitle')> AND itemtitle LIKE #itemtitle#</cfif>
    </cfquery>

Why is my query not working? Again, I have checked that the form submit, js function, and coldfusion syntax are all valid. Only when this line is added to the query does it break. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:26:29+00:00Added an answer on June 9, 2026 at 2:26 am

    Looking at the code I can’t see where you are adding quotes around the itemtitle value, it looks like you are currently executing a line which looks like:

    AND itemtitle LIKE something
    

    instead of:

    AND itemtitle LIKE 'something'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to have my form fields submit after the onchange event. The
Hi the below Javascript is called when I submit a form. It first splits
The controller action is called after the completedCallback not after $(this).submit(). See the code
Possible Duplicate: jQuery/Javascript function to clear all the fields of a form I need
how would I execute a JavaScript function on a PHP form before submit but
I want to have multiple multiple choices given to user after the form submit
is it possible to stop the submission of a form,after submit button has been
I want to submit my form after a user clicked/touched the checkbox: THE HTML
After I submit the form unsuccessfully, the form looses all the values I typed
After I submit a form I have 2 $_POST variables. In the landing page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.