PDA

View Full Version : Rich Text Editor & Form Submition Problem


self-defence
09-03-2006, 08:56 AM
Hey

I'm trying to insert a rich text editor (http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm) into my web site, but I'm having some problems.

I would like tu set up the form so that when it is submited the values gets posted into the url bar, but I can't seem to get it working.

First I load the initial content via php and that works but when I submit the data typed intu the text area only the preloaded content gets posted to the url bar.

Any ideas anyone?

_Aerospace_Eng_
09-03-2006, 11:01 AM
This should help you get started
<?php
if(isset($_POST['submit']) && $_POST['submit'] == 'Submit')
{
$rte1 = $_POST['rte1'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript" src="richtext.js"></script>
</head>
<body>
<?php
if(isset($rte1))
{
echo "<p>The text submitted from the textarea was: $rte1.</p>";
}
?>
<form name="myform" action="htmlform.php" method="post" onSubmit="updateRTE('rte1')">
<script type="text/javascript">
<!--
//Usage: initRTE(imagesPath, includesPath, cssFile)
initRTE("images/", "", "");
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', '', 400, 200, true, false);
//-->
</script>
<br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
The trick is to call updateRTE('rte1') onsubmit.

eddy9
09-03-2006, 11:30 AM
I would like tu set up the form so that when it is submited the values gets posted into the url bar

are you using the default "get" method or "post" ?

self-defence
09-03-2006, 11:38 AM
Ok this is the form (http://vb.streznik.org/razno/pub/edit/) I'm playing with the data that is loaded is not important, but if I change anything in the text box and submite the data only the preloaded data gets submited.

I've got no idea why and I've tryed both POST and GET methods. The only way I can get any data is if I use onsubmit="return submitForm();" but that just doesn't do me any good since I would like to insert the data into a DB.

Thanks

self-defence
09-03-2006, 12:01 PM
Thank you _Aerospace_Eng_ it works now :)
I was missing onSubmit="updateRTE('rte1')" in the code. I get it now and if I want to realod more I use onSubmit="updateRTEs()" and it also works.

Thank you again I know these are stupid bigginer problems but I just coulden't figure it out becouse I tryed to find the answer all day long.