12 Replies Latest reply on May 16, 2006 12:49 PM by Newsgroup_User

    brain drained

    martinstan Level 1
      Hi All
      I've spent days creating a database(my first) with admin page et all and I'm feeling pretty pleased with myself at the minute but my brain has now stopped working. Could someone please get me over a hurdle.
      I have a text field(memo) which is a recordset that i want to fill which a few hundred words of copy via a form field but what is happening is that the text is just running straight across my page. What I want it to do is 'go south my son' and just fill out a table cell to a fixed width ( say 500px) but I don't want it scrolling. Just filling it with as much text as is inputted into the form field. I don't mind if it's CSS or HTML. I hope this makes sense as I'm a couple of glasses into celebrating with a bottle of vino!
      Thanks
      Martin
        • 1. Re: brain drained
          Level 7
          Martin,
          You don't say what server language you are using but with asp vbscript it
          would be something like this.

          <%=Replace(rsYour_Recordset.Fields.Item("Name_of
          Field").Value,chr(13),"<br>")%>

          Hope this helps.
          Dave
          "martinstan" <webforumsuser@macromedia.com> wrote in message
          news:e45cug$l7c$1@forums.macromedia.com...
          > Hi All
          > I've spent days creating a database(my first) with admin page et all and
          I'm
          > feeling pretty pleased with myself at the minute but my brain has now
          stopped
          > working. Could someone please get me over a hurdle.
          > I have a text field(memo) which is a recordset that i want to fill which
          a few
          > hundred words of copy via a form field but what is happening is that the
          text
          > is just running straight across my page. What I want it to do is 'go south
          my
          > son' and just fill out a table cell to a fixed width ( say 500px) but I
          don't
          > want it scrolling. Just filling it with as much text as is inputted into
          the
          > form field. I don't mind if it's CSS or HTML. I hope this makes sense as
          I'm a
          > couple of glasses into celebrating with a bottle of vino!
          > Thanks
          > Martin
          >


          • 2. Re: brain drained
            martinstan Level 1
            Hi Baxter
            Thanks for your help with this but although your suggestion didn't break anything it didn't work either. You were right in assuming I'm using asp. Here is the code I've added to the table cell in a section where I want to update CV's(of varying size) to.
            <td><%=Replace(rsConsultants.Fields.Item("ConsultantCv").Value,chr(13),"<br/>")%></td>. I'm pretty new to asp and datbases so my appolgies if I've misunderstood your instruction.
            Cheers
            Martin
            • 3. Re: brain drained
              martinstan Level 1
              <%=Replace(rsYour_Recordset.Fields.Item("Name_of
              Field").Value,chr(13),"<br>")%>
              Ok I'm kind of getting somewhere with this. If in my memo field I hit a return, then sure enough using Baxter's code I get line breaks. But say somone just keeps typing in this field. How can I force a line break at the end of each line in my memo field? I suppose it's the same as me entering copy into this box and hitting reply...or is it?
              Cheers
              Martin
              • 4. Re: brain drained
                Level 7
                Look into TinyMCE http://google.com

                it will allow you to insert HTML code into your database with a WYSIWYG
                interface so that you only have to put the structure of the page down and
                allow it to do the rest of your content.
                "martinstan" <webforumsuser@macromedia.com> wrote in message
                news:e4arsq$cg9$1@forums.macromedia.com...
                > <%=Replace(rsYour_Recordset.Fields.Item("Name_of
                > Field").Value,chr(13),"<br>")%>
                > Ok I'm kind of getting somewhere with this. If in my memo field I hit a
                > return, then sure enough using Baxter's code I get line breaks. But say
                > somone
                > just keeps typing in this field. How can I force a line break at the end
                > of
                > each line in my memo field? I suppose it's the same as me entering copy
                > into
                > this box and hitting reply...or is it?
                > Cheers
                > Martin
                >


                • 5. Re: brain drained
                  martinstan Level 1
                  Wow..and I thought this was gonna be straight forward...can of worms springs to mind. Thanks for your hel
                  Martin
                  • 6. Re: brain drained
                    martinstan Level 1
                    Wow..and I thought this was gonna be straight forward...can of worms springs to mind. Thanks for your help
                    Martin
                    • 7. Re: brain drained
                      Level 7
                      Just wondering if you have a link to this page? There could be one other
                      solution.
                      I'd like to take a look at the page. If not could you post the code for the
                      html portion.
                      Dave
                      "martinstan" <webforumsuser@macromedia.com> wrote in message
                      news:e4av85$gf2$1@forums.macromedia.com...
                      > Wow..and I thought this was gonna be straight forward...can of worms
                      springs to mind. Thanks for your help
                      > Martin


                      • 8. Re: brain drained
                        martinstan Level 1
                        Hi Baxter
                        Any help with this would be greatly appreciated. here is the code for the page that gets updated.

                        <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
                        <!--#include file="../Connections/connAdmin.asp" -->
                        <%
                        Dim rsConsultants__MMColParam
                        rsConsultants__MMColParam = "1"
                        If (Request.QueryString("id") <> "") Then
                        rsConsultants__MMColParam = Request.QueryString("id")
                        End If
                        %>
                        <%
                        Dim rsConsultants
                        Dim rsConsultants_numRows

                        Set rsConsultants = Server.CreateObject("ADODB.Recordset")
                        rsConsultants.ActiveConnection = MM_connAdmin_STRING
                        rsConsultants.Source = "SELECT * FROM Consultants WHERE ConsultantID = " + Replace(rsConsultants__MMColParam, "'", "''") + " AND online=yes"
                        rsConsultants.CursorType = 0
                        rsConsultants.CursorLocation = 2
                        rsConsultants.LockType = 1
                        rsConsultants.Open()

                        rsConsultants_numRows = 0
                        %>
                        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
                        <html>
                        <head>
                        <title>Untitled Document</title>
                        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                        </head>

                        <body>
                        <table width="641" border="1">
                        <tr>
                        <td width="206"><img src="../images/allied_logo_small.gif" width="74" height="66"></td>
                        <td width="220"><p><%=(rsConsultants.Fields.Item("ConsultantFName").Value)%><br>
                        <%=(rsConsultants.Fields.Item("ConsultantSurname").Value)%></p>
                        <p><strong><%=(rsConsultants.Fields.Item("ConsultantDescpt").Value)%></strong></p></td>
                        <td width="193"><img src="../images/<%=(rsConsultants.Fields.Item("ConsultantPIC").Value)%>large.jpg"></td>
                        </tr>
                        <tr>
                        <td colspan="3"><table width="600" border="1">
                        <tr>
                        <td><%=Replace(rsConsultants.Fields.Item("ConsultantCv").Value, chr(10),"<br />")%></td>
                        </tr>
                        </table></td>
                        </tr>
                        <tr>
                        <td> </td>
                        <td> </td>
                        <td> </td>
                        </tr>
                        </table>
                        </body>
                        </html>
                        <%
                        rsConsultants.Close()
                        Set rsConsultants = Nothing
                        %>

                        and here is the code for the page I edit.
                        <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
                        <!--#include file="../Connections/connAdmin.asp" -->
                        <%
                        ' *** Edit Operations: declare variables

                        Dim MM_editAction
                        Dim MM_abortEdit
                        Dim MM_editQuery
                        Dim MM_editCmd

                        Dim MM_editConnection
                        Dim MM_editTable
                        Dim MM_editRedirectUrl
                        Dim MM_editColumn
                        Dim MM_recordId

                        Dim MM_fieldsStr
                        Dim MM_columnsStr
                        Dim MM_fields
                        Dim MM_columns
                        Dim MM_typeArray
                        Dim MM_formVal
                        Dim MM_delim
                        Dim MM_altVal
                        Dim MM_emptyVal
                        Dim MM_i

                        MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
                        If (Request.QueryString <> "") Then
                        MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
                        End If

                        ' boolean to abort record edit
                        MM_abortEdit = false

                        ' query string to execute
                        MM_editQuery = ""
                        %>
                        <%
                        ' *** Insert Record: set variables

                        If (CStr(Request("MM_insert")) = "form1") Then

                        MM_editConnection = MM_connAdmin_STRING
                        MM_editTable = "Consultants"
                        MM_editRedirectUrl = "index.asp"
                        MM_fieldsStr = "ConsultantFName|value|ConsultantSurname|value|ConsultantDescpt|value|ConsultantCv|value| ConsultantPIC|value|online|value"
                        MM_columnsStr = "ConsultantFName|',none,''|ConsultantSurname|',none,''|ConsultantDescpt|',none,''|Consult antCv|',none,''|ConsultantPIC|',none,''|online|none,Yes,No"

                        ' create the MM_fields and MM_columns arrays
                        MM_fields = Split(MM_fieldsStr, "|")
                        MM_columns = Split(MM_columnsStr, "|")

                        ' set the form values
                        For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
                        MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
                        Next

                        ' append the query string to the redirect URL
                        If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
                        If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
                        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
                        Else
                        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
                        End If
                        End If

                        End If
                        %>
                        <%
                        ' *** Insert Record: construct a sql insert statement and execute it

                        Dim MM_tableValues
                        Dim MM_dbValues

                        If (CStr(Request("MM_insert")) <> "") Then

                        ' create the sql insert statement
                        MM_tableValues = ""
                        MM_dbValues = ""
                        For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
                        MM_formVal = MM_fields(MM_i+1)
                        MM_typeArray = Split(MM_columns(MM_i+1),",")
                        MM_delim = MM_typeArray(0)
                        If (MM_delim = "none") Then MM_delim = ""
                        MM_altVal = MM_typeArray(1)
                        If (MM_altVal = "none") Then MM_altVal = ""
                        MM_emptyVal = MM_typeArray(2)
                        If (MM_emptyVal = "none") Then MM_emptyVal = ""
                        If (MM_formVal = "") Then
                        MM_formVal = MM_emptyVal
                        Else
                        If (MM_altVal <> "") Then
                        MM_formVal = MM_altVal
                        ElseIf (MM_delim = "'") Then ' escape quotes
                        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
                        Else
                        MM_formVal = MM_delim + MM_formVal + MM_delim
                        End If
                        End If
                        If (MM_i <> LBound(MM_fields)) Then
                        MM_tableValues = MM_tableValues & ","
                        MM_dbValues = MM_dbValues & ","
                        End If
                        MM_tableValues = MM_tableValues & MM_columns(MM_i)
                        MM_dbValues = MM_dbValues & MM_formVal
                        Next
                        MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

                        If (Not MM_abortEdit) Then
                        ' execute the insert
                        Set MM_editCmd = Server.CreateObject("ADODB.Command")
                        MM_editCmd.ActiveConnection = MM_editConnection
                        MM_editCmd.CommandText = MM_editQuery
                        MM_editCmd.Execute
                        MM_editCmd.ActiveConnection.Close

                        If (MM_editRedirectUrl <> "") Then
                        Response.Redirect(MM_editRedirectUrl)
                        End If
                        End If

                        End If
                        %>
                        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
                        <html>
                        <head>
                        <title>Add New Consultant </title>
                        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                        </head>

                        <body>
                        Add New Consultant
                        <p> </p>


                        <form action="<%=MM_editAction%>" method="POST" enctype="application/x-www-form-urlencoded" name="myform">
                        <table align="center">
                        <tr valign="baseline">
                        <td nowrap align="right">First Name:</td>
                        <td>
                        <input type="text" name="ConsultantFName" value="" size="32">
                        </td>
                        </tr>
                        <tr valign="baseline">
                        <td nowrap align="right">Surname:</td>
                        <td>
                        <input type="text" name="ConsultantSurname" value="" size="32">
                        </td>
                        </tr>
                        <tr valign="baseline">
                        <td nowrap align="right">Consultant Description:</td>
                        <td>
                        <input type="text" name="ConsultantDescpt" value="" size="32">
                        </td>
                        </tr>
                        <tr>
                        <td nowrap align="right" valign="top">Consultant Cv:</td>
                        <td valign="baseline">
                        <textarea name="ConsultantCv" cols="50" rows="5"></textarea>
                        </td>
                        </tr>
                        <tr valign="baseline">
                        <td nowrap align="right">Consultant PIC:</td>
                        <td>
                        <input type="text" name="ConsultantPIC" value="" size="32">
                        </td>
                        </tr>
                        <tr valign="baseline">
                        <td nowrap align="right">Online:</td>
                        <td>
                        <input type="checkbox" name="online" value=1 >
                        </td>
                        </tr>
                        <tr valign="baseline">
                        <td nowrap align="right"> </td>
                        <td>
                        <input type="submit" value="Insert record">
                        </td>
                        </tr>
                        </table>
                        <input type="hidden" name="MM_insert" value="form1">
                        </form>
                        <p> </p>
                        <p> </p>
                        </body>
                        </html>

                        Hope this helps
                        Regards
                        Martin.

                        ps just to compound my headache, I uploaded the pages to the remote server for the first time last night for you to look at and received a Syntax error...even though locally they load up fine. Ouch!
                        • 9. Re: brain drained
                          Level 7
                          Hi!
                          You could try this. Put the table in a container and change the table width
                          to 100%

                          <html>
                          <head>
                          <title>Untitled"> http://www.w3.org/TR/html4/loose.dtd">
                          <html>
                          <head>
                          <title>Untitled</a> Document</title>
                          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

                          #wrapper { width: 780px;
                          margin-right: auto;
                          margin-left: auto;
                          }

                          </head>

                          <body>
                          <div id = "wrapper">
                          <table width="641" border="1">
                          <tr>
                          <td width="206"><img src="../images/allied_logo_small.gif" width="74"
                          height="66"></td>
                          <td

                          width="220"><p><%=(rsConsultants.Fields.Item("ConsultantFName").Value)%><br>
                          <%=(rsConsultants.Fields.Item("ConsultantSurname").Value)%></p>


                          <p><strong><%=(rsConsultants.Fields.Item("ConsultantDescpt").Value)%></stron
                          g></
                          p></td>
                          <td width="193"><img

                          src="../images/<%=(rsConsultants.Fields.Item("ConsultantPIC").Value)%>large.
                          jpg"
                          </td>
                          </tr>
                          <tr>
                          <td colspan="3"><table width="600" border="1">
                          <tr>
                          <td><%=Replace(rsConsultants.Fields.Item("ConsultantCv").Value,
                          chr(10),"<br />")%></td>
                          </tr>
                          </table></td>
                          </tr>
                          <tr>
                          <td> </td>
                          <td> </td>
                          <td> </td>
                          </tr>
                          </table>

                          </div>

                          </body>
                          </html>


                          "martinstan" <webforumsuser@macromedia.com> wrote in message
                          news:e4bsd7$ihj$1@forums.macromedia.com...
                          > Hi Baxter
                          > Any help with this would be greatly appreciated. here is the code for the
                          page
                          > that gets updated.
                          >


                          • 10. Re: brain drained
                            martinstan Level 1
                            Hi Baxter
                            Thanks for your perseverance. I'll give it a try when I get back to base a bit later. Someone else has suggested this..
                            <textarea name="textval" cols="" rows="" id="textval" wrap="hard">

                            What do you think?
                            Martin
                            • 11. Re: brain drained
                              martinstan Level 1
                              Well Baxter et all
                              I've used a combination of the two ideas and I'm happy to report that it has work a treat.
                              Thanks again
                              Martin
                              • 12. Re: brain drained
                                Level 7
                                Your Welcome! That's what we like.
                                Good Luck!

                                "martinstan" <webforumsuser@macromedia.com> wrote in message
                                news:e4ckfo$k3t$1@forums.macromedia.com...
                                > Well Baxter et all
                                > I've used a combination of the two ideas and I'm happy to report that it
                                has work a treat.
                                > Thanks again
                                > Martin