ehart12
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
I have tried What is the best way to accomplish this?
Thank you,
Eric
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
ASKER
Thank you!
ASKER
What is the best way to start off the form with the submit button hidden until the ITEM field validates with a record?