|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Wysiwyg editor question
I have used Mitchell Harpers code to get a Wysiwyg browser editor working in ASP
I even got it to work, great stuff Mitch ! What I can do now, is generate HTML with the WYSIWYG editor and store it in a database field. But... what I CAN NOT do yet, is load the saved HTML back into the WYSIWYG editor to start editing it. Any help out there on this one ? code |
|
#2
|
|||
|
|||
|
just place it in the value attribute of the hidden field.
f.e; <input type="hidden" name="editorContent" value="<%=yourDatabaseValueHere%>"> et voila. |
|
#3
|
|||
|
|||
|
i think you will need abit more than that cuz mytchs code only transfer the value from the editor to the hidden field not the otehr way around..(is this right? ) so by placing a value for the hidden form won't actually place value to the editor. (i hope im right)
so, what you gotta do is a little bit of js coding. First, place another hidden form then create a javascript that transfers value from the hidden form to the iView iframe when the page loads. hope this helps
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#4
|
|||
|
|||
|
I think i've used this technique to make editoworks professional. Have a look at the editworks live demo.
http://www.tools2code.com/editworkspro |
|
#5
|
|||
|
|||
|
Hi,
I have answered this question a few times to people now.. maybe there should be an article about it on the website?? <thanks> Just like to say thanks to every1 who helped me with this solution! </thanks> right.... 1. find the code in the editor (WYSIWYG editor) which writes the iFrame...should be something like: <iframe id="iView" style="width: 600px; height:200px;" </iframe> what you need to do is to tell the editor where the SOURCE of the iFrame is... for this you need to change the code above to: <iframe id="iView" style="width: 600px; height:200px;" src="load.asp?id=<%= id %>"></iframe> you will see that there is now "src="load.asp?id=<%=id%>"" what this does is when the editor loads it goes away and loads "load.asp"... this page looks up the record in the DB to then return to the iFrame window... so... if you loaded load.asp?id=1 then load.asp would return the first record...so in load.asp you need to open the DB and use an SQL statement to open the record where ID = $ID (in URL) ok so far?......! so when you call editor.... the value of load.asp is returned to the iFrame window.... that should work for ya! I hope... let me know if you dont get what I'm on about..!! regards, |
|
#6
|
|||
|
|||
|
what happens if he jsut want to load a text not a value from database?
|
|
#7
|
|||
|
|||
|
if you simply want to load text, either from a text (.txt) file or an HTML file, you can simply change the source of the iFrame.
so if you wanted to load, hello.htm for example, you would have the following line: <iFrame src="hello.htm";> <iFrame> .... I am using this now to edit HTML files, but my editor is a PHP file... although it could just as easily be ASP! I use: iFrame src="load.php?filename=<?= $filename ?>"><iFrame> obviously in ASP you would use something like: iFrame src="load.asp?filename=<%= request.querystring("filename") %>"</iframe> so the link would look like: editor.asp?filename=hello.htm then the contents of hello.htm would be loaded in to the editor window.... Is that what you mean James? |
|
#8
|
|||
|
|||
|
yeah i understand what your saying fakker.
but is that round trip to server necessary if you just want a text displayed not content of a file? Say, you want the editor to have initial text or comfirmation of some sort "from the server". I would just make another hidden field and js which puts the content of the hidden field to the editor when the page is loaded. Using this tehnique, u can even load the page if you want to. U open the file from the server. do you know what i mean? |
|
#9
|
|||
|
|||
|
aah ok.....I see what u mean...
to get initial text displayed in the window, you could write in to the init() function the default text... like.... var src = "this is the default text"; function Init() { iView.document.designMode = 'On'; iframeWin = window.frames.iView; iframeWin.document.open(); iframeWin.document.write(src); iframeWin.document.close(); } then when init is called, it displayed the value of "src" which in this case is "this is the default text". You could also make a button to set the value of src.... for example... function write_hello() { iframe.Win.Document.write('hello'); } function write_tester() { iframe.Win.Document.write('tester'); } then you could have a button or hyper link on the editor page which might be like: click here to write "hello" in the window then you would create a hyperlink such as: <a href="#" onClick="write_tester()";>Click me</a> or something like that! I have not tried this, so all this code is simply an assumption that it will work.... it should do though!! lol! ![]() |
|
#10
|
|||
|
|||
|
wysing editing
I am trying to use what was posted here that in the iframe I put src=load.asp&id=id and in load.asp I open the recordset.
Somehow the iframe is not pulling in the data correctly. How do I pass it from load.asp to the iframe |
|
#11
|
|||
|
|||
|
when you open load.asp?id=X on its own does it show the record?
also, make sure you dont have any of the iframeWin.document.write(src); stuff in the init function. You dont want anything being written to the iFrame apart from the src... if you have any code or an example we could look at, that may help also... |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Wysiwyg editor question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|