Combining javascript and CF question
OK, it's finally sinking in that CF processes everything on the server, sends an html page back to the client, and JS does its thing on the client side. I suppose it's confusing because of the way one can intermingle CF code, html, and JS in one big heap of spaghetti. Here's my question: suppose I have a page that receives an ID via the url header, does a query on the ID and pre-populates a form, allows a user to edit the form, and when submitted, has a bunch of code that checks for various conditions and if a particular condition is met, asks the user to confirm the update. Suppose also that I would prefer that the user stay on the same page while the processing is going on and only go to a new page if the submit is accepted. Originally, I had the form submit to a new .cfm page that had all the logic and queries, but am now realizing that I can't call any kind of JS from that page until it finishes processing and the server sends the whole ball of wax back to the client. Right?
So in the limited depths of my understanding, I am thinking that instead, either
A. instead of submitting the form and going to another page for processing, I need to use onSubmit() to initiate all the processing code via cffunction calls, and if a particular condition is met, trigger the JS confirm() function (or jQuery dialog for that matter) and use the results of that to finally submit the form for processing, or that
B. the solution lies within Ajax, of which I know almost nothing.
Thoughts?
