Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to break the text in form

    If the user is going to enter some information in a textarea in form. When i load this information into database i need the data to be entered as lines each of 60 charectars.

    I mean when the user enters the data as a stretch, after every 60 charectars there should be a break which i should identify. Is there any procedure to do this.

    Thanks in Advance,
    Sam

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What server side language do you have?

    Database? SQL Server? MySQL? MsSQL? Oracle?

    Jee
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was wondering the same thing...

    It would be easier to use a server side language, but I think it could be done in javascript...

    I'm also curious as to why you want to do this...

    ~Quack

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    onsubmit="this.elements['textareaname'].value = this.elements['textareaname'].value.replace(/(.{60})/g,'$1\r\n')"

    something like that maybe (in the form tag)?

  • #5
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    JEEWHIZZ,
    I AM USING SQL SERVER

    QUACKHEAD.
    I AM TRYING THIS BECAUSE.
    I have a form where user will enter the information in a text area in a form. And i am going to load this into database.
    Later on if the user wants to retrieve the record,

    If there are paragraphs in the middle also its displayed as a stretch of data on the browser, but with in the table which i am displaying.

    If i am using the tag <pre></pre>
    the record is displayed as a stretch of line, if the user is not going to hit the enter button at the end of the line in the text area.But the paragraphs are coming in middle in this case but if its a stretch of data we have to scroll all the way to the right.

    Hope that i was able to explain a little bit. If you are not clear about this please question me again.

    Thanks a lot for you help. I really aprriciate your help.

    Thanks,
    Sam

  • #6
    Super Moderator sage45's Avatar
    Join Date
    May 2002
    Posts
    1,060
    Thanks
    0
    Thanked 13 Times in 13 Posts

    Thread Moved

    I moved your thread to a more appropriate medium... Thread moved to mySQL Server Side Forum...

    -sage-
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Samind,

    i'm not totally sure i understand what you mean, but i get the feeling it's more of a presentation issue then a storage one (which would make moving this thread questionable... )
    If it's the way the stored text is presented you worry about, i would simply store it in the database as-is (large varchar, for instance), and worry about how it looks at the client side.
    Is there a possibility for you to show an example of what you want to accomplish, like a simple page with the text hard-coded (so you can avoid database access for now)?
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #8
    New Coder
    Join Date
    Jun 2002
    Location
    London & Oxford
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I agree with ronaldb66, store the data in its original form and worry about how to display it when you pull it out of the database.

    Since you are using SQL Server, I assume you are querying your database on an ASP page? If so when you have the recordset open, assign this field to a variable and then you can chop it up using the Left, Right and Mid functions before writing the HTML to the client.
    As easy as 3.1415926535897932384626433832795028841


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •