Link to home
Start Free TrialLog in
Avatar of ehart12
ehart12Flag for United States of America

asked on

Dynamically query database and display DIV based on FORM TEXT entry

I am using a CFFORM with several different element types. I have a text field called "ITEM" that I would like to validate the user-entered-data against a database query as soon as the user leaves the field. I would like to diplay an image of a green check and the ITEM DESCRIPTION (queried from the database query) if the record exists, or an image of a red x if no records were found.

I have tried What is the best way to accomplish this?

Thank you,

Eric
SOLUTION
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ehart12

ASKER

Thank you for your responses...  Using code from each of your responses I was able to get something working!  

What is the best way to start off the form with the submit button hidden until the ITEM field validates with a record?
Well that's a little different.  For that I'd probably use jquery to call a cfc , instead of binding to a .cfm page. Have the cfc return a json structure with "status" and "description". Then set the image and hide/show the submit button based on the response.  (edit: it's cleaner and more flexibility imo).  But you should probably open a separate question for that.
Avatar of ehart12

ASKER

Thank you!