Page 1 of 1
DIVs + FORMs
Posted: Mon Apr 05, 2004 9:25 pm
by Illusionist
hmm... strange question i suppose... But what i have is a form inside of a DIV. And what i want is when the submit is clicked It shows in back int he DIV. Sort of treat the DIV as Frame. If thats possible. I've looked around, but can't seem to find anythign realting to this. Anytone know of anything that might work??
Also, the form is comming from a sepereate page. I have soemthing like this:
Code: Select all
<div id="content">
<? include('myform.php'); ?>
</div>
If that helps any!!
Posted: Tue Apr 06, 2004 12:32 am
by feyd
if you don't want to reload the page, you'll have to use javascript to both validate and reflow the contents of your div with something like this:
Code: Select all
<script language="Javascript"><!--
function reflowContent(formObj,newContent)
{
if( typeof formObj == "object" && typeof newContent == "string")
formObj.innerHTML = newContent;
}
function formSubmit(formObj,flowHere)
{
// do your validation here.
// if it's all good, reflow the content.
var container = ((document.getElementById)?(document.getElementById(flowHere)):(document.all[flowHere]));
reflowContent(container,"blah blah blah blah blah new content!");
// because the form doesn't really submit anywhere, tell the browser to not send it.
return false;
}
--></script>
and your php include would look something like:
Code: Select all
<form onsubmit="return formSubmit(this,'content')"><input type=text name="junk" value="junk"></form>