by HatakeKakashi » Thu Aug 24, 2006 7:13 pm
Lol, I came to see if B had replied to another post I made and while i was looking down the page I realized I already made this one you're talking about.
I did it so that when I edit a form, I can retain past inputed file names. Without this, I could prefill the text areas and change the default radio buttons and such, but the webbrowser won't let the browser set a file choise, so when I bring up the page to edit, I juat show the picture or text of the file name, and then when thats clicked I can edit the page.
All it takes is a hidden input field with value named "changeimg" for example, and then you display whatever you want in a div, and you can then attach
onClick="this.form.changeimg.value='1'; this.form.action='thepageyouwereone.php';"
and then its just a matter of adding an if($_POST['changeimg']==0){draw div with text or image}else{draw input box}
now when you click the div with the text or picture, the page will reload with an input field there now.
On issue you need to make sure is that if you have multiple of these on the page you post and retrieve all the toggling variables, so that you don't lose input fields when you open a new one.
Also, this is a ghetto way of doing it these days, because its not using AJAX to change the div. It is possible to change the div to an input field with ajax, its not that hard, I just haven't gotten around to updating the page with new techniques.