Hi,
I've recently done this very thing using some very simple code. I'll try to help you out with this.
Front End - pre edit
In my case this is a list of items that can be reviewed., or that have already been reviewed and can now be edited.
[html]
<img src="image/edit.png" title="Click to write review" alt="Write Review" onmouseover="this.style.cursor='pointer' onclick="loadReviewControl();" />' ;
[/html]
Note: the loadReviewControl function takes a numebr of parameters as you will see in the function definition:
The JavaScript -
function loadReviewControl(pnMode, pnItemID, pnItemType, pcElementID, pcEventName, pnRating, pcReview)
-
{
-
GetXmlHttpObject() ; // defines a global variable for the XMLHTTP object
-
gcItemID = pcElementID ;
-
lcStartDisplay = document.getElementById(pcElementID).innerHTML ;
-
gcUrl = '../lib/loadReviewData.php? // QS completed passed on parameters...
-
goXMLHTTP.onreadystatechange = function()
-
{
-
// use a 'ghost' function to control the flow more accuratley
-
writeResponse();
-
};
-
goXMLHTTP.open("GET",gcUrl,true) ;
-
goXMLHTTP.send(null) ;
-
}
-
This uses the XMLHTTP Object and then rites the responsetext back to the innerHTML of the element defined by the fourth parameter.
Part of this process is to call a php file with a query string. Using the query string to control what is returned. In my case the PHP simply builds up the form controls to display. This is done by defining one variable to be the full output and then having one echo line at the bottom.
This is just a sample of the way I tackled this problem. I can't show you this in operation as it is on an access controlled site that is yet to be launched but it does work very well. Especially when you complete the submission side of the process using the same technology - they need never leave the page.
What happens in my case is they click an icon to load the controls, edit the review and click an icon to either close or save and close. This process generates and destroys controls as required, giving the impression of hiding and showing controls.
I hope this helps you out, if you have any questions post back and I'll try to help.
Cheers
nathj