Another how do I get started question.

Last post 10-16-2004, 7:51 AM by lundrigan. 4 replies.
Sort Posts: Previous Next
  •  10-13-2004, 2:29 AM 2060

    Another how do I get started question.

    Hi,
     
    I'm not an asp programmer, but I have fooled around with asp enough that I can kind of do things - I can kind of read it and manipulate it, but I can't write it.
     
    I bought aspEdit, and now have upgraded to cuteEdit. Both programs seem to have really, really poor documentation and people seem to get a lot of non-answers in these forums from support. I spoke to support, and they wanted $100 to add the 3 things to an existing asp page to make it work. I'll go buy someone elses program, and junk this one, before I'll pay that much for 5 or 10 minutes work! They said there was no time for "custom" work. Sounds to me like there is no time for supporting their product. I realize that it says this program is for developers, but why not take the time to explain things to the power user types? I'm sure it would be simple enough with some futher explanation. And after looking through the forum, I see that there are others with the same problems.
     
    With all that said, is there anyone here who can explain how I add the editor to an existing textarea in an existing asp page? Exactly, step-by-step. The textarea is submitted to a database. I am willing to pay a reasonable amount for someone to show me how it goes (but not twice the price of the program).
     
    Sorry if I sound like I have an attitude, but I guess I do.
     
    Jill
  •  10-13-2004, 1:12 PM 2066 in reply to 2060

    Re: Another how do I get started question.

    Jill,

     

    Let's start from creating a HTML Form Page. Then we replace the textarea with CuteEditor.

     

    Create a new HTML page and name it 'CuteEditorTest.asp' Copy the following code and paste it into the body section of 'CuteEditorTest.asp' page :

     

    Inserting Records :

    <form action="target.asp" method="post" ID="Form1">

    title:
    <input type="text" name="title" ID="Text1"><br>
    Comments : <textarea name="comments" cols="20" rows="5" ID="Textarea1"></textarea><br>
    <input type="submit" value="submit" ID="Submit1" NAME="Submit1">

    </
    form>

    The above HTML code creates a simple Form asking for title and comments. You can later change them according to what you want your users to enter.

     

     

    ASP Action Page


    Create a new ASP page 'target.asp' in the same directory as the above HTML page. Copy and paste the following ASP code into 'target.asp' page :

     

    <%

    ' Declaring variables

    Dim title, comments, data_source, con, sql_insert


    ' Receiving values from Form

    title = ChkString(Request.Form("title"))

    comments = ChkString(Request.Form("comments"))

    data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _

    Server.MapPath("form.mdb")

    sql_insert = "insert into news (title, comments) values ('" & _

    title& "', '" & comments & "')"

    ' Creating Connection Object and opening the database

    Set con = Server.CreateObject("ADODB.Connection")

    con.Open data_source

    con.Execute sql_insert


    ' Done. Close the connection

    con.Close

    Set con = Nothing 

    ' A Function to check if some field entered by user is empty

    Function ChkString(string)

    If string = "" Then string = " "

    ChkString = Replace(string, "'", "''")

    End Function

     

    %>

     

    Our above ASP page 'target.asp' will receive values entered by user in the HTML Form and will first check to see if some fields have been left empty. Then it will insert those values into our Access database.
     

    Let's replace the regular textarea with CuteEditor:

     
     
    I hightlighted the changes we need to made.
     
    Create a new HTML page and name it 'CuteEditorTest.asp' Copy the following code and paste it into the body section of 'CuteEditorTest.asp' page :

     

     

    <!-- #include file = "include_CuteEditor.asp" --> 

    Inserting Records :

    <form action="target.asp" method="post" ID="Form1">

    title:
    <input type="text" name="title" ID="Text1"><br>
    Comments : <textarea name="comments" cols="20" rows="5" ID="Textarea1"></textarea>
     

    <%

        'Create a new editor class object

        Dim editor

        Set editor = New CuteEditor

        'Set the ID of this editor class

        editor.ID = "Editor1"

        editor.FilesPath = "CuteEditor_Files"

        editor.ImageGalleryPath = "/Uploads"

        editor.Draw()

        ' Retrieve the data from editor: Request.Form("Editor1_HTMLContent")

    %>

    <br>
    <input type="submit" value="submit" ID="Submit1" onfocus="save(Editor1)"> NAME="Submit1">

    </
    form>

     


     

    ASP Action Page


    Create a new ASP page 'target.asp' in the same directory as the above HTML page. Copy and paste the following ASP code into 'target.asp' page :

     

    <%

    ' Declaring variables

    Dim title, comments, data_source, con, sql_insert


    ' Receiving values from Form

    title = ChkString(Request.Form("title"))

    comments = ChkString(Request.Form("Editor1_HTMLContent"))

    data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _

    Server.MapPath("form.mdb")

    sql_insert = "insert into news (title, comments) values ('" & _

    title& "', '" & comments & "')"

    ' Creating Connection Object and opening the database

    Set con = Server.CreateObject("ADODB.Connection")

    con.Open data_source

    con.Execute sql_insert


    ' Done. Close the connection

    con.Close

    Set con = Nothing 

    ' A Function to check if some field entered by user is empty

    Function ChkString(string)

    If string = "" Then string = " "

    ChkString = Replace(string, "'", "''")

    End Function

     

    %>

     

     

    Hope it helps.
     
    Let me know if you have any further questions.
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-13-2004, 2:46 PM 2072 in reply to 2066

    Re: Another how do I get started question.

    Adam,

     
    Thank you, but this is the same page I was sent to before. As I said, this is in an existing asp page, which does not set up its text areas quite like an html page, and the text in the textarea is submitted to a database, not to another page.
     
    Anyone else?
     
    Thanks,
     
    Jill
  •  10-13-2004, 2:57 PM 2073 in reply to 2072

    Re: Another how do I get started question.

  •  10-16-2004, 7:51 AM 2103 in reply to 2072

    Re: Another how do I get started question.

    An asp page is just an html page on steriods.  So you must already have a text area somewhere on the page.  The textarea must exist between the <form></form> tags. The form tag must then have an action="" that is either pointing to itself or to another asp page for processing.  If you are using Frontpage to create the connection to the database and the form then you will have to rethink your strategy a little.

     
    You might have to actually create a asp processing page that the form submits to. 
View as RSS news feed in XML