Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Split Textarea (by lines), trim and save to Database

Reply
Thread Tools

Split Textarea (by lines), trim and save to Database

 
 
David
Guest
Posts: n/a
 
      09-18-2007
Hi,

I want to know if it is possible to do the following.

I have a form which lets users select a product, enter a quantity and
set the info into a Textarea field.
Each time the user hits the 'Set' button, it adds another line into
the Textarea, e.g.

______________________
5 x Product1
63 x Product2
115 x Product3
75 x Product 7
______________________

At present, I just have the data sent in an email, but now I need to
save each line into our database, linked to a specific PO Number.
Is there a way to strip the data in the Textarea into variables on the
next page like

Within a loop which runs through each line
Strip the product code and qty

Product Code = Product1
Product Qty = 5




Load Product Code & Product Qty into the Database
where ...........................

Then go to the next line and load into database

Appreciate your help on this

David

 
Reply With Quote
 
 
 
 
ThatsIT.net.au
Guest
Posts: n/a
 
      09-18-2007

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi,
>
> I want to know if it is possible to do the following.
>
> I have a form which lets users select a product, enter a quantity and
> set the info into a Textarea field.
> Each time the user hits the 'Set' button, it adds another line into
> the Textarea, e.g.
>
> ______________________
> 5 x Product1
> 63 x Product2
> 115 x Product3
> 75 x Product 7
> ______________________
>
> At present, I just have the data sent in an email, but now I need to
> save each line into our database, linked to a specific PO Number.
> Is there a way to strip the data in the Textarea into variables on the
> next page like
>
> Within a loop which runs through each line
> Strip the product code and qty
>
> Product Code = Product1
> Product Qty = 5
>
>
>
>
> Load Product Code & Product Qty into the Database
> where ...........................
>
> Then go to the next line and load into database
>
> Appreciate your help on this
>
> David
>



You can use the textrange object
http://msdn2.microsoft.com/en-us/library/ms533042.aspx


but it would be easier to use a array to hold values not the textarea

 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      09-18-2007
David <(E-Mail Removed)> wrote:

>Hi,
>
>I want to know if it is possible to do the following.
>
>I have a form which lets users select a product, enter a quantity and
>set the info into a Textarea field.
>Each time the user hits the 'Set' button, it adds another line into
>the Textarea, e.g.
>
>______________________
>5 x Product1
>63 x Product2
>115 x Product3
>75 x Product 7
>______________________
>
>At present, I just have the data sent in an email, but now I need to
>save each line into our database, linked to a specific PO Number.
>Is there a way to strip the data in the Textarea into variables on the
>next page like
>
>Within a loop which runs through each line
>Strip the product code and qty
>
>Product Code = Product1
>Product Qty = 5


Aren't the lines separated by newline characters? Then - assuming your
ASP page is using VBScript - use the Split function
(http://msdn2.microsoft.com/en-us/library/0764e5w5.aspx) to break the
contents of the textarea into individual lines. If you using
Javascript to write your ASP code, it's the split method of the String
object (http://msdn2.microsoft.com/en-us/library/t5az126b.aspx)

--
Tim Slattery
MS MVP(DTS)
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 2 04-24-2007 01:59 AM
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 26 02-26-2007 05:06 PM
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 6 12-25-2006 08:47 PM
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 0 10-25-2006 11:00 PM
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 0 08-28-2006 11:00 PM



Advertisments