Thickbox form processing can be done with AJAX to post the response back to the thickbox.
To see it in action click here
I could`nt find a tutorial anywhere that seemed to achieve this, and as it is relatively simple and because there was a lot of intrest in the forums I have pasted my finished code here
Firstly just a file to fire off the thickbox, this calls the form.php file to do the processing
Thick Box demo
click here
Here is the form.php that processes within the thickbox.
It firstly displays the form because there is no value in post, when onclick is fired it makes a requests to itself using Jquery (AJAX), and embeds the response (text (JSON)) using Jquery within the “message” div.
Please enter your password
:
:
Its really that simple, within the “if not empty post” declaration just include your validation, you will need some form of sessions checking, as this could be bypassed relatively easily.
You will also need to download a copy of thickbox and place it within the thickbox dir, along with a copy of jquery!
You can download the complete zipped file (with Jq + thickbox) here
22 responses to “Thickbox form processing”