Helpful Information
 
 
Category: Server side development
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

What server side language do you have?

Database? SQL Server? MySQL? MsSQL? Oracle?

Jee

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

onsubmit="this.elements['textareaname'].value = this.elements['textareaname'].value.replace(/(.{60})/g,'$1\r\n')"

something like that maybe (in the form tag)?

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

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

-sage-

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... :D)
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)?

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.










privacy (GDPR)