karl - Thu, Oct 17th - 2002
How-To: Saving content
I get an email a day from people asking how to save the content of the editor.  I realize this might not be as clear in 0.5 (even though it's exactly the same, things are a bit more obfuscated).  I hope the following helps:

[b:f7d436e63c]A sample in ASP and PHP can be downloaded from the downloads section: http://openmymind.net/download.php?search=ewe_sample[/b:f7d436e63c]

Saving the content from the editor isn't particularly difficult.  Basically, the way I make it work is that I create a hidden input field within a form.  Then when the form is submitted, I transfer the content of the editor into the hidden form field and submit the form.  Then accessing the content is like accessing any other form element.
 
The reason I don't hard code any examples is that it each person will use a custom form, and accessing the form element depends on which language is being used (asp, php, cf...).
 
However, there is a sample form created, and that should be useful. Let's pretend you already have a form, and it looks like this:
 
[code:1:f7d436e63c]
<html>
<head>
  ...
</head>
<body>
...
<form method="post" action="save.php">
  Title: <input type="text" size="30" name="title"><br>
  Category: <input type="text" size="30" name="category"><br><br>
 
  <input type="submit" value="Save">
</form>
...
</body>
</html>
 [/code:1:f7d436e63c]
 
You would integrate EWE as follows
[code:1:f7d436e63c]
<html>
<head>
   ...
   <script language="jscript">
     function save(form){
       if (ViewCurrent == 2)
         document.all.ewe.innerHTML = document.all.ewe.innerText;
  
          form.content.value = cleanup(document.all.ewe.innerHTML);
      }
   </script>
 
<form method="post" action="save.php" onSubmit="save(this);">
  <input type="hidden" name="content">
  Title: <input type="text" size="30" name="title"><br>
  Category: <input type="text" size="30" name="category"><br><br>
 
  <input type="submit" value="Save">
</form>
...
(you can put the editor anywhere)
</body>
</html>
[/code:1:f7d436e63c]
 
 
 
As you can see, when the form is submitted via the onSubmit event, the save function is called and a reference to the form is passed.  The save function (located in the head) pretty much puts the content of the editor into the hidden form field – which I called “content” in this example.

Jouri - Fri, Oct 18th - 2002

How can I load content into the editor ? e.g. a html-document or a database-query ?

karl - Fri, Oct 18th - 2002

i replied in a separate thread:

[url]http://www.openmymind.net/forum/viewtopic.php?t=6[/url]

Karl

Anonymous - Tue, Oct 22nd - 2002

Hello!
I'm new here. I tried your program and I love it  :D 

I tried to integrate the save function with PHP but it don't work.  :cry: 
can anyone help me please?  :? 


thank you very much!

tecONE - Tue, Oct 22nd - 2002

sorry, but my english is not very good.....

I copied and pasted the code but where is the html text?? in which variable is it stored??  :?

karl - Tue, Oct 22nd - 2002

In the above example, the HTML content is stored in the hidden form field named "content".

In PHP, you would access this after submitted the form with $_POST['content']   and in ASP it would be Request.Form("Content")

The entire point of the same function is to take the content of the editor and copy it into a hidden form field.   That way, you can access the content after submitting a form like you would any other form element.

If you need more help, it might be useful for you to put up a page with the editor on it so we can see what you are doing wrong.

KArl

tecONE - Tue, Oct 22nd - 2002

I'm a php developer. to read the var is not the problem, the problem is, that that var is empty. 
where should I paste this?
[code:1:eee997b54c]   <script language="JScript">
     function save(form){
     //  if (ViewCurrent == 2)
         document.all.ewe.innerHTML = document.all.ewe.innerText;

          form.content.value = cleanup(document.all.ewe.innerHTML);
      }
   </script>
[/code:1:eee997b54c]

karl - Tue, Oct 22nd - 2002

Well, the assumption is that you already have a form with other content.   You should call the "save" function when the form is submitted via:

<form id="myFrm" method="post" action="save.php" onSubmit="save();">


or  if you are using a link to submit the form:

<a href="#" onClick="save();document.myFrm.submit();return false;">

If you already have a function that does other stuff (like validate), you can stick it in there.  Make sure to create the hidden form field for it to be able to copy into.

Incidently, did you email me this morning? which means I won't reply if it was u since we'll get it working here...

tecONE - Tue, Oct 22nd - 2002

I don't know what I do wrong..... it won't work...  :cry: 

I only want to get the var to insert it in a mysql table. that's no problem, if I get the variable....
is it so hard to get the variable??

i've done all as you say...

karl - Tue, Oct 22nd - 2002

can you send me your source code or put it up on the web so I can trouble shoot it?

Karl

tecONE - Wed, Oct 23rd - 2002

after a few hours of hard work, I find out a way to save the data.
thank you very much Karl.

now it's time to load data out of a mysql db  :D

boonkerz - Mon, Nov 11th - 2002
Not work :-(
<HTML xmlns:move>
<head>
<title>Easy Web Editor (EWE)</title>
<script language="JScript">  
  function onLoad(){
    var ewe = new EWE(null, 'sample.css');
    ewe.load(document.all.eweContainer);
  }
</script>
<script language="JScript"> 
     function save(form){ 
     //  if (ViewCurrent == 2) 
         document.all.ewe.innerHTML = document.all.ewe.innerText; 

          form.content.value = cleanup(document.all.ewe.innerHTML); 
      } 
</script>
<script language="JScript" src="source/ewe.js"></script>
</head>

<body unselectable="on" bgcolor="#FFFFFF" onLoad="onLoad();" onKeyDown="dispatcher();">

  
<form name="form" method="get" action="save.php" onSubmit="save(this)">
<div id="eweContainer" unselectable="on"></div><input type="submit" name="Submit" value="Abschicken">
<input type="hidden" name="content"> </form>

</body>
</html>  

_____________________________

The Browser show when i submit:

http://localhost/5/index.html?content=&Submit=Abschicken

and the content var is empty??

My English is not good :-)

Thanks

chemanfit - Mon, Nov 11th - 2002
link no good
your link is not any good since it is a localhost link.  need to put your ip address there and port if it is not the standrd port 80, or the actual web address to the site

Other than that, not sure what the problem is.

Anonymous - Mon, Nov 11th - 2002

Hi Karl, very nice application! :)

I am trying to use your JScript save function written in the How-To: Saving content section.

When the form is submitted, the <input type=hidden name=content> isn't being propagated with the content from the EWE editor like it should. Could you help me figure out why?

HERE IS MY (YOUR) CODE:

INDEX.PHP:

<HTML xmlns:move>
<head>
<title>Easy Web Editor (EWE)</title>
<script language="JScript"> 
<!--
function onLoad(){ 
var ewe = new EWE(); 
ewe.load(document.all.eweContainer, document.all.hiddenContent.innerHTML); 
}

function save(form){
if (ViewCurrent == 2)
document.all.ewe.innerHTML = document.all.ewe.innerText;
form.content.value = cleanup(document.all.ewe.innerHTML);
}
//-->
</script>
<script language="JScript" src="source/ewe.js"></script>
</head>
<body unselectable="on" bgcolor="#FFFFFF" onLoad="onLoad();" onKeyDown="dispatcher();">
<div id="eweContainer" unselectable="on"></div>
<div id="hiddenContent" style="position:absolute;visibility:hidden"><?php print("HELLO WORD!"); ?></div> 
<form method="post" action="save.php" onSubmit="save(this);"> 
<input type="hidden" name="content">
<table cellpadding="1" cellspacing="1" border="1">
<tr>
<td>Warning: This action is final.</td>
</tr>
<tr>
<td><input type="submit" value="Save"></td>
</tr>
</table>
</form>
</body>
</html>

SAVE.PHP:

<?php
$file = fopen("new_file.php", w);

fwrite($file, $_POST['content']);
fclose($file);

print($_POST['content']);
?>

Any suggestion on how to fix this JScript function?

Anonymous - Mon, Nov 11th - 2002

I KNOW THE PROBLEM MUST BE THIS JSCRIPT LINE:

form.content.value = cleanup(document.all.ewe.innerHTML);

ITS OBVIOUSLY NOT converting the contents within the EWE editor into the hidden form field (content) before moving to the save.php script.

BECAUSE print($_POST['content']); comes up blank!

:( :(

Anonymous - Mon, Nov 11th - 2002
THE ANSWER!!!
Ok, THE PROBLEM is the function should be called something other than save! call it mysave and it will work!

Prolly cause there is already a built-in function called save in JScript OR I think it's confusing itself with the save function within the EWE application itself!!!

/p

karl - Mon, Nov 11th - 2002

ewe already uses a save() function...it's a dummy one. 

If you are going to use your own save function,  go into ewe.js and remove it, modify it to do what you want, or use a different name.

Karl

boonkerz - Tue, Nov 12th - 2002
can you?
Hey

Can you post a complete code for php?

Thanks

chemanfit - Tue, Nov 12th - 2002

dont know if this helps but here goes.

what you had before

[code:1:4620d44554]function save(form){ 
if (ViewCurrent == 2) 
document.all.ewe.innerHTML = document.all.ewe.innerText; 
form.content.value = cleanup(document.all.ewe.innerHTML); 
} 
[/code:1:4620d44554]

what I think might help:

[code:1:4620d44554]function save(){ 
if (ViewCurrent == 2) 
document.all.ewe.innerHTML = document.all.ewe.innerText; 
form['frmSave'].content.value = cleanup(document.all.ewe.innerHTML); 
} 
[/code:1:4620d44554]

Also name your form frmSave in the body of your document.  Hope that helps.

PeteBerlin - Wed, Dec 4th - 2002
sorry, problems with my var in save.php
sorry Karl,

I used EWE 4.x until now and now i have some problems to save my content with the new EWE 0.6a.... until now i [b:3e4bd2b795]load[/b:3e4bd2b795] the whole content with a var that called "$content" like this:

[b:3e4bd2b795]ewe/edit.php?content=1203 [/b:3e4bd2b795]
(so that the content from a file [i:3e4bd2b795]1203[/i:3e4bd2b795] was put in the EWE-Container - edit.php is what was your index.html)

after that[b:3e4bd2b795] I want to save[/b:3e4bd2b795] all the content in the same file [i:3e4bd2b795]1203[/i:3e4bd2b795] . In the old EWE 4.x (my edit.php) I've done it like this:

document.frmSave.action = "save.php?content=<? echo $content ?>";
document.frmSave.submit(); 

So that the HTMLcontent was save in my file [i:3e4bd2b795]1203[/i:3e4bd2b795] (or any other file). In this way i build up a nice little CMS-System.
---
BUT NOW, I wanted to write the same to save the HTMLContent with your nice little (great an big!) WYSYWIG-Editor. in the ewe.js but it's a script, so that i only get this from my brows 
[b:3e4bd2b795]ewe/save.php?content=<? echo $content ?>[/b:3e4bd2b795]

after I put THAT into the ewe.js:

  //save form
  ne = document.createElement("FORM");
  ne.id = ne.name = 'frmEWESave';
  ne.method = 'post';
  ne.action = 'save.php?content=<? echo $content ?>';
  document.body.appendChild(ne);

You see the Problem? I can't get my variable in the adress-line of my browser, but that was my simple way to save the content in the right file.

Do you know what to do? Pleeeasse help.

Thank you,
Peter

karl - Wed, Dec 4th - 2002

Well....

The quickest way would probably be to use your own custom save function and form.

In your edit.php, create a new form:

[code:1:ece6efe4d0]
<form name="myform" method="post" action="save.php">
<input type="hidden" name="contentID" value="<?=$content?>">
<input type="hidden" name="htmlcontent">
</form>
[/code:1:ece6efe4d0]
and your own save function
[code:1:ece6efe4d0]
function mySave(){
 if (ViewCurrent == 2)
    toggleView();
    document.myform.htmlLContent.value = cleanup(document.all.ewe.innerHTML);
  document.myform.submit();
}
[/code:1:ece6efe4d0]
then simply edit ewe.js to call your custom function:
[code:1:ece6efe4d0]
  ne = document.createElement("IMG")
  ne.id = 'Save';
  ne.enableInHTML = 'true';
  ne.unselectable = 'on';
  ne.onclick = "mySave()";
  ...
[/code:1:ece6efe4d0]


Since you won't be able to pass PHP variable to ewe.js, you'll have to come up with a small trick like this...

Karl

zonezero - Sun, Dec 15th - 2002
Save Button vs Save Form
I followed the posts here and I can load content with:
ewe.load(document.all.eweContainer,'<?=$content?>');

and save the content with the modifications to index.html as suggested by karl with the new js function and hidden/vis forms.

However your example totally ignores the nice little floppy image to save the form.  I will need to change the ewe.js file to do this?  If so can you tell us which parts need to be modified to make that button work with the hidden/vis form but without the submit button?

karl - Mon, Dec 16th - 2002

Hi zonezero.

I think maybe the new version I released last night (0.6A2L) might help you.  The save function and form are now placed in the index.html as an example - because, as you noticed, most people will want to modify it to fufill their needs.

As long as you name the save function the same, you can do with it what you want.

Lemme know if that answers your needs,
Karl

tecONE - Tue, Dec 17th - 2002

hello!

i have written a save and load function in PHP with mySQL support.

i will send it to Karl when it's really finished and debuged.

so stay tuned  :D

frustrated - Thu, Dec 19th - 2002
I've tried everything...
Hello...

At first glance EWE looks fantastic. Very easy, no fluff. Congrats are in order.

Now on to my frustration:

I have tried EVERYTHING to post a simple html form. I'll submit my code below. 

1)I tried karl's original example and on save.php I do an "echo $content" and it's empty.

2)Someone suggested renaming the function to anything but save. I named it save2, changed the form to read "onSubmit="save2(this);" and $content is still empty.

3)Someone put some code up saying to name the form FrmSave and to give the form element a name. Tried that. $content is still empty.

I have tried EVERYTHING. I'm not doing anything fancy. I just want to echo $content on the next page and it wont work.

Here is my full code below. My save.php page simply reads: 
[code:1:f91f4badfb]
<?php
echo $title;
echo $category;
echo $content;
?>[/code:1:f91f4badfb]

Here's my main page:

[code:1:f91f4badfb]
<html> 
<head> 
  <script language="JScript" src="source/ewe.js"></script>
  <script language="JScript">
  <!--
    function load(){
     var ewe = new EWE();
     ewe.load(document.all.eweContainer);
    }
  //-->
  </script>
   
<script language=”jscript”> 
     function save2(form){ 
       if (ViewCurrent == 2) 
         document.all.ewe.innerHTML = document.all.ewe.innerText; 
  
          form.content.value = cleanup(document.all.ewe.innerHTML); 
      } 
   </script> 

</head>
<body style="background-color: #FFFFFF;" onLoad="load();">

<form method="post" action="save.php" onSubmit="save2(this);"> 

  Title: <input type="text" size="30" name="title"><br> 
  Category: <input type="text" size="30" name="category"><br><br> 
  <div id="eweContainer" unselectable="on"></div>
    <input type="hidden" name="content"> 
  <input type="submit" value="Save"> 
</form> 
</body> 
</html> 
[/code:1:f91f4badfb]

I've tried the ewe container both inside and outside the form...

Last but not least... I'm also getting a javascript error that reads:

Error: Unexpected call to method or propety access.

I just downloaded EWE today and am using IE6.

any help very much appreciated...

frustrated - Thu, Dec 19th - 2002
a simple test...
just tried something like this:

[code:1:9e26afd7f2]
<script language=”javascript”> 
     function save2(form){ 
       if (ViewCurrent == 2) 
         document.all.ewe.innerHTML = document.all.ewe.innerText; 
         // form.content.value = cleanup(document.all.ewe.innerHTML); 
         var foo = cleanup(document.all.ewe.innerHTML); 

if (foo=='') {
alert('Form field content is useless');
event.returnValue=false;
}
}
 </script> [/code:1:9e26afd7f2]

it doesnt matter if I type or dont type in the editor. I always get the alert...

karl - Fri, Dec 20th - 2002

Frustrated:

I've taken the code you posted here and it works.  I'm using IE 6.0 and tried it with 0.5 and 0.62AL.

I've posted the working example online for you to look at it. If you have any further problems, it would help if you posted your editor so that I could look at it.

go here: http://www.openmymind.net/editor/test/index.html  to see the editor

it'll go to save.php when you submit the form

you can see the code for save.php by going:

http://www.openmymind.net/editor/test/save.phps

Karl

frustrated - Fri, Dec 20th - 2002
FOUND IT!
I copied your code to the server... it worked like a charm. I then went through every line of code to see what the difference was. This is the line that made the difference.

In your code on the other page you write:

[code:1:127ea029a1]<script language=”javascript”> [/code:1:127ea029a1]

once I changed it to read:

[code:1:127ea029a1]<script language="javascript"> [/code:1:127ea029a1]

It worked... the quote marks you give in your original example on the front of this thread make the whole thing not work. I would reccomend editing your first message so it displays the correct quote marks.

This all seems silly... but on my win2k   iis server w/ ie6 as my client changing the quotes back and forth turns $content on and off on save.php.

thanks for all your help...

zonezero - Thu, Dec 26th - 2002
Hmmm...
I had it all working like you recently posted, but I dont want to use a "Submit" form button.  How do you make clicking the floppy icon on the far left of the tool bar do the submitting the contents?

Once I can make that floppy icon button submit to a save script I am home free...like I said I already had it working with the title and category forms and submit button.


randy

zonezero - Thu, Dec 26th - 2002
RE: Hmmmmm
[code:1:ced17408c4]<HTML xmlns:move>
<head>
<title>Easy Web Editor (EWE)</title>
<script language="JScript">  
  function onLoad(){
    var ewe = new EWE(null, 'sample.css');
    ewe.load(document.all.eweContainer,'<?=$content?>');
  }
  function sampleSave(){
    if (ViewCurrent == 2)
      toggleView();
    document.forms['sampleSave'].content.value = cleanup(document.all.ewe.innerHTML);
    //alert('This function shows the basics of saving, but is left up to the implementor to customize');
    document.forms['sampleSave'].submit();
  }
</script>
<script language="JScript" src="source/ewe.js"></script>
</head>

<body bgcolor="#FFFFFF" onLoad="onLoad();" onKeyDown="dispatcher();">
<div id="eweContainer" unselectable="on"></div>

<form method="post" action="save.php" id="sampleSave">
  <input type="hidden" name="content">
</form>
</body>
</html>[/code:1:ced17408c4]

It was all about naming things correctly and setting up the action handler on the form....look at the three instances of  "content" and where I swapped the // markers.  My suggestion would be to make your sample code look like this with a save.html file that has a note about put your <asp | php | perl | xxx> code here.

You can still have your category and other input forms within the form tag and have the floppy icon submit it all to your processing script.

Randall

Mr.Simian - Fri, Mar 14th - 2003

This save function will only work if ViewCurrent is equal to 2.
ViewCurrent was set to 1 in ewe.js so it never saved.  :D 
*bummer*

function sampleSave(){ 
    if (ViewCurrent == 2) 
    ......

Kenson - Wed, Apr 16th - 2003
How to wrap html code instead of get text!
Hi Karl, very nice application! :lol: 

I have successfully to save the text into DB.
But the problem is how can i get the html text instead of original text save into DB.
For Example:
ABCDE[b:9c53478785]FGHIJ[/b:9c53478785][u:9c53478785]KLMNOPQRST[/u:9c53478785]
then need to save into DB is:
ABCDE<b>FGHIJ</b><u>KLMNOPQRST</u>

For currently i can view the html code but after press submit button, only save in original text.

Pls Help!

Thanks!

delevante - Mon, Apr 28th - 2003
the ewe container div within the form
Hi Karl,

Love the editor. However the copy of the editor's contents to the hidden form element doesn't seem to be happening when the editor's container (the div element) is placed [b:ee1f062aeb]within[/b:ee1f062aeb] the form (within the <form></form> tags). Any suggestions? I want to have it appear inside the form.

Delevante

chemanfit - Mon, Apr 28th - 2003

As with any problem there are usually many solutions, however some are better than others.  I present to you a solution that may not be the best, but will do the trick.  

If you need to have form elements on either side of the editor (ie before and after) then what I would propose is to make two forms.  The first one would more or less be a dummy form and the second be the actual form with the hidden input for the copying of the contents into.  Part of the save function could then be modified to copy the form element values from the top form to the bottom form and then submit the bottom form, thus incorporating EWE into what looks like one form and acts like one form, but is really two forms.  Of course this requires some javascript to do this. 

This may not be the best way, but if coded correctly is a viable solution.  The easiest way of course is to use the editor as the last input and have the save function do the copying of contents and submitting of the form and not use a submit button as usually seen on forms.

I have not looked into the actual question of the div within the form tag.  I have had problems with tags not being balanced correctly and the form tag has to be outside both the opening and closing table tags to work correctly, but I don't know if that is the answer for div's or not.

Good luck.

Madrose - Tue, Apr 29th - 2003
Frastrated
I am trying to save the content of ewe editor from within a forum with other elements.
The code I am using is:
[code:1:b9b77f3bb5]
  function sampleSave(){
    document.REPLIER.Post.value = cleanup(document.all.ewe.innerHTML); 
	document.REPLIER.submit.disabled = true;
	document.all.REPLIER.action.submit();
  }
[/code:1:b9b77f3bb5]
Where Post is the field that should contain the data, REPLIER is the name of the form.
If I press on the submit button of the fom, the form is posted and the data is saved. But if I try to press on the save button I am getting a Javascript error saying:
[quote:b9b77f3bb5]
Object doen't support this property or method
[/quote:b9b77f3bb5]
and the form will not submit.

Any body can help me with this?!!!!!!!!!

Madrose - Tue, Apr 29th - 2003
Re: Frastrated
[quote:0aea4514ab="Madrose"]I am trying to save the content of ewe editor from within a forum with other elements.
The code I am using is:
[code:1:0aea4514ab]
  function sampleSave(){
    document.REPLIER.Post.value = cleanup(document.all.ewe.innerHTML); 
	document.REPLIER.submit.disabled = true;
	document.all.REPLIER.action.submit();
  }
[/code:1:0aea4514ab]
Where Post is the field that should contain the data, REPLIER is the name of the form.
If I press on the submit button of the fom, the form is posted and the data is saved. But if I try to press on the save button I am getting a Javascript error saying:
[quote:0aea4514ab]
Object doen't support this property or method
[/quote:0aea4514ab]
and the form will not submit.

Any body can help me with this?!!!!!!!!![/quote:0aea4514ab]
Just to say also, I have tried 
[code:1:0aea4514ab]
	document.all.forms['REPLIER'].submit();
	document.forms['REPLIER'].submit(); 
	document.all.REPLIER.submit();
[/code:1:0aea4514ab]

karl - Sat, May 3rd - 2003

what the heck are you trying to do?

document.REPLIER.submit.disabled = true; ???

have you tried the simplest way?

function sampleSave(){
  document.REPLIER.Post.value = cleanup(...);
  document.REPLIER.submit();
}

Karl

Anonymous - Sun, May 4th - 2003

[quote:d005876371="karl"]what the heck are you trying to do?

document.REPLIER.submit.disabled = true; ???

have you tried the simplest way?

function sampleSave(){
  document.REPLIER.Post.value = cleanup(...);
  document.REPLIER.submit();
}

Karl[/quote:d005876371]
this document.REPLIER.submit.disabled = true; is used to disable the submit button. This way you don't press that button twice by mistake.

and yes I did try what you are refering to also.
My problem is obly when used within a form, but outside the form it is working.

Arion - Thu, May 15th - 2003
Saving
Ok, I know you've probably covered this many times, but I'm currently using your program in conjunction with one of my own and I need the editor to load one .html file and then save it to the same one.  Is there any way to do this using HTML, DHTML, Jscript?  Most of the users using my program use a free host so they can't use ASP or PHP.

chemanfit - Thu, May 15th - 2003

as far as I know the html, dhtml, and javascrpt are all client side scripts, ie they wont work with files on the server.  You will have to use a serverside scripting language to work with the files, as well as the ability to change the permissions on the file(s) in question.  There are many drawbacks to free hosting and that is sometimes one of them.

Anonymous - Mon, May 19th - 2003

Hey karl, if the save.php file is on one site, could the html file be saved on another, say if I wanted to use your save.php file to save my content.

chemanfit - Mon, May 19th - 2003

that would just stuff your data into his database/saving place, assuming that the variables matched up.  I am not sure why you would want to do that.  Unless you have a site that doesn't give you server side scripting, if that is the case then I would say that you need to upgrade.  Although, if the use of Karl's file is hypothetical, and you actually mean use a file on one server that has scripting that you maybe have made yourself, and a client that has a different server, you probably could do that.  I would suggest moving your client to your server though, if that is what you are trying to do.

Just use a form and the action="http://my.server.com/save.php", that will take the user to the other server and process the file and then could send the user back after it is done processing with a header location=blah blah

Hope that helps.

DannyBoy - Sun, Jul 6th - 2003
Doesn't work :/
hi..
I'm a coldfusion developer, I'm trying to use the EWE thing but it doesn't work. This what I've got so far.

[b:eeb7d9cd5b]EWE page:[/b:eeb7d9cd5b]

<script language="JScript">
   function onLoad(){
    var ewe = new EWE(null, 'sample.css');
    ewe.load(document.all.eweContainer,'');

  }
  function sampleSave(){
document.location.href = 'upload.cfm';  }
  var editorPath = "";
</script>
<script language="JScript" src="source/ewe.js"></script>
</head>

<body bgcolor="#FFFFFF" onLoad="onLoad();" onKeyDown="dispatcher();">
<div id="eweContainer" unselectable="on"></div>

<form method="post" id="sampleSave">
  <input type="hidden" name="HTMLContent">
</form>

[b:eeb7d9cd5b]Action page[/b:eeb7d9cd5b]

<cfquery datasource="kidlink" dbtype="odbc" name="uploading">
INSERT INTO newsletter (newsletter_body)
VALUES	('#form.HTMLContent#')
</cfquery>

[b:eeb7d9cd5b]And the error I get from my Coldfusion server is..[/b:eeb7d9cd5b]

Element HTMLCONTENT is undefined in FORM.  
The Error Occurred in C:\Inetpub\wwwroot\kidlink\history\newsletter2\editor3\upload.cfm: line 10
8 : <cfquery datasource="kidlink" dbtype="odbc" name="uploading">
9 : INSERT INTO newsletter (newsletter_body)
10 : VALUES ('#form.HTMLContent#')
11 : </cfquery>

The address is :
[url]http://danielb.serveirc.com/kidlink/history/newsletter2/editor3/sample.cfm[/url]

Hope someone can help me. Maybe I'm doing something wrong, but I don't get how to make the EWE thing to do what it's gotta do.. maybe it's my script, maybe it's something else.. who knows..

Thanks

chemanfit - Sun, Jul 6th - 2003

I ma ttired from driving home from vacation this weekend but at a first glance looks like all you are doing is on call to samplesave you are just going to a new page.  I am not sure if the form variables are actually being sent, you should change it to document.samplesave.submit()

also you need to specify the action in the form something like action=action.cfm

now this may not be the actual problem since I have only tooled with coldfusion a little bit.

maybe that will help some

DannyBoy - Wed, Jul 9th - 2003
giving ewe default content
hi :)
I have a question.. I'm doing a query to a database and I'm trying to give ewe the results content.

[b:a5bd04c28d]This is my query:[/b:a5bd04c28d]
<cfquery name="geteditorial" datasource="kidlink">
SELECT	nleditorial_body
FROM	newsletter_editorial
WHERE	nleditorial_body = 1
</cfquery>

[b:a5bd04c28d]and this is what I'm trying to do:[/b:a5bd04c28d]
<div id="eweContainer" unselectable="on"></div>
<form method="post" id="sampleSave" action="pages/management/change_editorial.cfm" target="management">
  <input type="hidden" name="HTMLContent" <cfoutput query="geteditorial">value="#nleditorial_body#"</cfoutput>>
</form>

what I'm trying to do is to give the EWE text box default content, can someone please tell me what I'm doing wrong because it won't display what's on the database  :?

chemanfit - Thu, Jul 10th - 2003

use the hidden div method it is within the sticky of how to load content

it works quite well

tomroe - Mon, Sep 15th - 2003
Save-button??
Hi
I'm quite new programmer and I almost lose my mind thinking that save-button...I've read all these messages in this forum concerning this saving-subject but...The thing is, that I tried all these codes but it doesn't work. If I want to make this save-button working, what the heck should I do??? What code should I put where, and what files do I need???? Pliiis,help me!

sasha - Tue, Sep 16th - 2003

same problem here....

very uninformative topic

i thought i'd get this EWE thingy work in minutes but now i'll have to look through the code to figure out how it's working and what and where should i write the <form> to get it working

you really need to make the integration part easier

take off the sample alert message and just put a post form onto the 'save' button

karl - Fri, Oct 3rd - 2003

This isn't aimed at anyone in particular, I'm not trying to chew out anyone...I just feel guilty a lot about people needing help with EWE and my unavailabiliy/lack of interest:

EWE is meant for people who can hack it.  I'm sorry I don' thave any better answers...I'm too tired and don't care enough anymore (please keep my attitude in mind when using this product...AKA you are pretty much on your own!)