Skip to main content
July 17, 2008
Answered

Query Search Database with input

  • July 17, 2008
  • 1 reply
  • 288 views
Hi,

I am new to CF - I am building a FAQ form which queries the database based on the input of the user. The Search page and results page are one [faq.cfm] - I get the following error
quote:

Element INPUT is undefined in FORM1.


Here is my code
This topic has been closed for replies.
Correct answer Newsgroup_User
The name of the form, 'Form1' in this example, is only relevant on the
client and is used in JavaScript type client side processing.

On the server, data submitted from a 'post' request is always contained
in the 'form' scope and is referenced as such, irrespective of what the
from was named on the client.

So your code should just be: LIKE '#FORM.input#'.

Naming your controls more specifically then 'Form1' and 'input' would
make for more easily understood source code.

Also, it is a great habit to get used to using <cfqueryparam...> in all
your <cfquery...> blocks. Learn it early and it saves retraining
oneself later.

1 reply

Newsgroup_UserCorrect answer
Inspiring
July 17, 2008
The name of the form, 'Form1' in this example, is only relevant on the
client and is used in JavaScript type client side processing.

On the server, data submitted from a 'post' request is always contained
in the 'form' scope and is referenced as such, irrespective of what the
from was named on the client.

So your code should just be: LIKE '#FORM.input#'.

Naming your controls more specifically then 'Form1' and 'input' would
make for more easily understood source code.

Also, it is a great habit to get used to using <cfqueryparam...> in all
your <cfquery...> blocks. Learn it early and it saves retraining
oneself later.
July 17, 2008
Thank you :)