...

View Full Version : Server-Side into Client



varuag
07-27-2007, 06:10 PM
Hi,
I want to have <%=adoRecordSet("mysite")%> into a client-side script (javascript) for an FCKEditor.

This causes an error:


<script type="text/javascript">
var oFCKeditor = new FCKeditor('text') ;
oFCKeditor.BasePath = '/editor/' ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = "<%=adoRecordSet('mysite')%>";
oFCKeditor.Create() ;
</script>
<noscript>Javascript must be enabled to use this editor!</noscript>

Is the quotation right? I'm extracting info from a database with SQL, and want that text preloaded.


Thanks!

Daemonspyre
07-27-2007, 06:13 PM
Unfortunately, the quotation is not... Remember that in all ASP code, single quotes will always comment out your code, breaking your app.



<script type="text/javascript">
var oFCKeditor = new FCKeditor('text') ;
oFCKeditor.BasePath = '/editor/' ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = '<%= adoRecordSet("mysite")%>';
oFCKeditor.Create() ;
</script>
<noscript>Javascript must be enabled to use this editor!</noscript>

varuag
07-27-2007, 06:19 PM
Unfortunately, the quotation is not... Remember that in all ASP code, single quotes will always comment out your code, breaking your app.



<script type="text/javascript">
var oFCKeditor = new FCKeditor('text') ;
oFCKeditor.BasePath = '/editor/' ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = '<%= adoRecordSet("mysite")%>';
oFCKeditor.Create() ;
</script>
<noscript>Javascript must be enabled to use this editor!</noscript>

Nope.
Instead of the editor at ALL, it comes up.

Daemonspyre
07-27-2007, 06:29 PM
What comes up? Your recordset? Or another error?

varuag
07-27-2007, 07:14 PM
it comes up with literally nothing!

Daemonspyre
07-27-2007, 10:12 PM
Here's a question -- Are you using Firefox or IE?

If Firefox, then you need get the WebDeveloper and Firebug add-ons. It's probably a Javascript issue, not an ASP issue.

If you are using IE -- Switch to Firefox, get the add-ons, and then you will have that many more tools to help you code correctly!.

miranda
07-29-2007, 05:12 PM
Why not just use the ASP version of the fckeditor?

varuag
07-30-2007, 01:52 PM
How do i convert all this ASP VBScript into ASP JavaScript??

Daemonspyre
07-30-2007, 02:05 PM
Since VBScript and JavaScript are written totally differently, you are going to have to either retool your app or just try to fix the issue.

Try viewing the source... What does the same snippet of code say when you view the source of your app?

Also, you said that <%= adoRecordset("mySite") %> was stopping your app from working.

What does a

<%
response.write(adoRecordset("mySite"))
response.flush
%>

return in your code? If it returns something like:



oFCKeditor.Value = 'http://www.mysite.com/test.asp?var=12345';

you should be fine.

BUT if it has URL Encoded characters (%22 ["], %2C [,], %3F [?]) you may run into issues.

miranda
07-30-2007, 04:15 PM
You can build the FCKEditor editor using asp code. Here is a working example from one of the sites I have done




<!-- #INCLUDE file="fckeditor/fckeditor.asp" -->
<%
Dim oEditor
Set oEditor = New FCKeditor
oEditor.BasePath = "/admin/fckeditor/"
oEditor.ToolbarSet = "Basic"
oEditor.Value = "<h2 style=""text-align:center; color:#C00;"">Warning!</h2><h5 style=""text-align:center;"">If pasting from a Microsoft Word document, use the Paste From Word option to clean the text.</h5>" & _
"<div style=""padding-left:100px;""><strong>To remove this notice, follow theses steps: </strong><ol><li> click your mouse inside the editor</li><li> click ctrl-a</li><li> click ctrl-x</li></ol></div>"
oEditor.Create "Description"
Set oEditor = Nothing
%>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum