Avatar billede plasmon Nybegynder
28. november 2003 - 11:39 Der er 2 kommentarer og
1 løsning

WYSIWYG problem, kan ikke hente fra formen

Hej jeg har et problem med min online redigering
Jeg kan ikke hente data ind fra formen. her er koden på siden som formen er på:

<!--#include file ="db.inc"-->
<%

Dim id, ndate, title, mtype, Tekst, style, file
Dim editorItems

    id = Request.Querystring("id")
    table = Request.Querystring("table")
    mode = Request.Querystring("mode")
    u_id1 = Request.Querystring("u_id1")
    sql = "select * from " & table & " Where id = " & Request.Querystring("id")
    Set editorItems = cn.execute(sql)

    If not editorItems.Eof Then

            id = editorItems("id")
            ndate = editorItems("dato")
            title = editorItems("titel")
            Tekst = editorItems("tekst")


    else
            style = "none"
            ndate = date()
            title = ""
            Tekst = ""
            file = ""
    end if
    editorItems.close
   
    set editorItems = nothing
   
%>
<html>

<head>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--

function Save_onclick() {
    SaveForm.Tekst.value = otherDoc.body.outerHTML;   
    SaveForm.submit();
}

function Back_onclick() {
    location.href="../default.asp"
}

function Del_onclick() {
var aux;

    aux = confirm("Vil du slette denne post ?")
    if (aux == true)
        { location.href = "deletenews.asp?id=<%=id%>" }
}

-->
</script>

</head>

<body bgcolor="#C0C0C0">

<h2 align="center"><font face="Verdana, Ariel, Helvetica" color="#000080"><small>Editoren</small></font></h2>

<form method="post" action="save.asp?table=<%=table%>&u_id1=<%=u_id1%>" name="SaveForm" enctype="multipart/form-data" onSubmit="this.tekst.value = document.all.iView.document.body.innerHTML; return true;">>
    <input type="hidden" name="id" value="<%=id%>">
    <input type="hidden" name="Tekst"  value="  ">
<%
If Request.Querystring("table") = "sider" and Request.Querystring("mode") = "add" Then
    If Request.Querystring("u_id1") = "" Then
        editor = editor & "<b>Underside til:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select size='1' onchange='self.location.href=this.options[this.selectedIndex].value'>"_
        & "<option>Vælg Noget Her</option>"_
        & ""
        sql="SELECT * FROM sider where u_id = 0 AND afd_id =" & session("afd")
        Set editorItems = cn.execute(sql)
        do until editorItems.EOF
        editor = editor & "<option value='editor.asp?table=sider&mode=add&id=-1&u_id1=" & editorItems("id") & "'>" & editorItems("titel") & "</option>"
        editorItems.movenext
        loop
        editor = editor & "</select><br>"
    Else
        sql="SELECT * FROM sider where u_id = " & Request.Querystring("u_id1")
        editor = editor & "<b>Underside til:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select size='1' onchange='self.location.href=this.options[this.selectedIndex].value'>"_
        & "<option value=" & Request.Querystring("u_id1") & ">Under side til forgående valgte side</option>"
        Set editorItems = cn.execute(sql)
        do until editorItems.EOF
        editor = editor & "<option value='default.asp?action=editor&table=sider&mode=add&u_id1=" & editorItems("id") & "'>" & editorItems("titel") & "</option>"
        editorItems.movenext
        loop
        editor = editor & "</select><br>"
    End If
   
end if
%>
<%=editor%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td width="30%"><strong><font face="Arial"><small>Date</small></font></strong></td>
      <td width="70%"><input type="text" name="ndate" size="10" value="<%=NDate%>">
        <font face="Arial" size="2">(mm/dd/aaaa)</font></td>
    </tr>
    <tr>
      <td width="30%"><strong><font face="Arial"><small>Title</small></font></strong></td>
      <td width="70%"><input type="text" name="title" size="40" value="<%=title%>"></td>
    </tr>
    </tr>
    <tr>
      <td width="100%" colspan="2"><blockquote>
        <span><strong><font face="Arial"><small>Tekst</small><small> </small></font><font color="#FF0000"
        face="Arial"><small>- indsæt neden for!</small></font></strong></span>
      </blockquote>
      </td>
    </tr>
  </table>
</form>
<span><span>
<input onclick="otherDoc.execCommand('Bold')" type="button" value=" B "> <input
onclick="otherDoc.execCommand('Italic')" type="button" value=" I "> <input
onclick="otherDoc.execCommand('Underline')" type="button" value=" U "> <input
onclick="otherDoc.execCommand('CreateLink')" type="button" value=" Link "> <input
onclick="otherDoc.execCommand('InsertOrderedList')" type="button" value=" List "> <select
id="FontSelection"
onchange="otherDoc.execCommand('FontName', false, this.options(this.selectedIndex).value)"
size="1">
  <option id="arial" value="arial">Arial</option>
  <option id="arial black" value="arial black">Arial black</option>
  <option id="arial narrow" value="arial narrow">Arial narrow</option>
  <option id="bookman" value="Bookman">Bookman</option>
  <option id="book antiqua" value="book antiqua">Book Antiqua</option>
  <option id="bookman old style" value="bookman old style">Bookman Old Style</option>
  <option id="century gothic" value="century gothic">Century Gothic</option>
  <option id="comic sans ms" value="comic sans ms">Comic Sans MS</option>
  <option id="courier" value="courier">Courier</option>
  <option id="courier new" value="courier new">Courier New</option>
  <option id="garamond" value="garamond">Garamond</option>
  <option id="georgia" value="georgia">Georgia</option>
  <option id="haettenschweiler" value="haettenschweiler">Haettenschweiler</option>
  <option id="helvetica" value="helvetica">Helvetica</option>
  <option id="impact" value="impact">Impact</option>
  <option id="lucida console" value="Lucida Console">Lucida</option>
  <option id="lucida sans unicode" value="Lucida Sans Unicode">Lucida Sans Unicode</option>
  <option id="marlett" value="Marlett">Marlett</option>
  <option id="microsoft sans serif" value="Microsoft Sans Serif">Microsoft Sans Serif</option>
  <option id="monotype corsiva" value="Monotype Corsiva">Monotype Corsiva</option>
  <option id="ms outlook" value="MS Outlook">MS Outlook</option>
  <option id="newcenturyschlbk" value="NewCenturySchlbk">NewCenturySchlbk</option>
  <option id="palatino" value="Palatino">Palatino</option>
  <option id="palatino linotype" value="Palatino Linotype">Palatino Linotype</option>
  <option id="symbol" value="Symbol">Symbol</option>
  <option id="tahoma" value="Tahoma">Tahoma</option>
  <option id="times" value="Times">Times</option>
  <option id="times new roman" value="Times New Roman">Times New Roman</option>
  <option id="trebuchet ms" value="Trebuchet MS">Trebuchet MS</option>
  <option id="verdana" value="Verdana">Verdana</option>
  <option id="webdings" value="Webdings">Webdings</option>
  <option id="wingdings" value="Wingdings">Wingdings</option>
  <option id="wingdings 2" value="Wingdings 2">Wingdings 2</option>
  <option id="wingdings 3" value="Wingdings 3">Wingdings 3</option>
  <option id="zapfchancery" value="ZapfChancery">ZapfChancery</option>
  <option id="zapfdingbats" value="ZapfDingbats">ZapfDingbats</option>
  <option id="null" selected value></option>
</select> <input type="button" value="Gem" name="Save" LANGUAGE="javascript"
onclick="return Save_onclick()"> <input type="button" value="Tilbage" name="Back"
LANGUAGE="javascript" onclick="return Back_onclick()"></span>
<span><input type="button" value="Slet" name="Del" LANGUAGE="javascript"
onclick="return Del_onclick()"></span><br>
<!--webbot bot="HTMLMarkup" startspan -->
<IFRAME id="TheFrame" src="template.asp?table=<%=table%>&id=<%=id%>" style="HEIGHT: 60%; WIDTH: 100%">
<!--webbot bot="HTMLMarkup" endspan -->
<!--webbot bot="HTMLMarkup" startspan -->
</IFRAME>
<!--webbot bot="HTMLMarkup" endspan -->
<script>

var otherDoc;
document.frames.TheFrame.document.designMode = "On";

function showSelectionFont() {
  var f;
  f = otherDoc.queryCommandValue("FontName");
  if (!f)
    f = "null";
  // to lower the string before comparting it - use all lower for all id's.
  f = f.toLowerCase();

  c = FontSelection.all[f];

  if ((c) && (!c.selected)) {
    c.selected = true;
  }
}

function init() {
  otherDoc = document.frames.TheFrame.document;
  otherDoc.body.onselect = showSelectionFont;
}

window.onload = init;

</script>
</span>
</body>
</html>
<%
cn.Close
Set cn = Nothing
%>
Avatar billede powell Nybegynder
28. november 2003 - 14:52 #1
For at hente informationer indtastet i en form benyttes:
<%
Dim strTitel

strTitel = Trim(Request("Titel"))
%>

Trim benyttes kun for at skære de uverflydige "space" tegn bort.
Avatar billede powell Nybegynder
28. november 2003 - 14:53 #2
Du benytter Querystring, da går jeg ud fra at du henter informationer fra adresse linien, er det korrekt?
Avatar billede plasmon Nybegynder
28. november 2003 - 23:41 #3
Fandt selv fejlen, jeg manglede og include en fil.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester