#1 (permalink)  
Old 11-01-03, 08:55 AM
Reed Reed is offline
New Member
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Forms

Forms
Hello programmers... I have a question:

Can someone tell me/give me an example of how to do this:

In a form you might type in field1 something, say something like this:

"123456789 123456789 123456789 123456789"

is it possible to have an ASP form entry page parse the data into (4) four other fields automatically.

Like this:

filed1 entry = "123456789 123456789 123456789 123456789"

result:

field2 = "123456789"
field3 = "123456789"
field4 = "123456789"
field5 = "123456789"

the ultimate idea here is to have the user type data into one filed, field1, and after a certain amount of data entry, which would always be the same data length have that data parsed into the other fields as outlined above. Actually, data length may change but there could be a space in between, in other words a user may type in field one this for example "1 2 3 4 5 6 7 8 9, the 1 would be parsed into field two, 2 into field 3, etc. and so on.

The common element is the space in between the numbers.

Any help would be appreciated.

I assume that this could be done in two ways: all in one form or one page, my preferance, or done using multiple forms, not my preferance.

The database will be an access 2000 database.

Any help and code samples would be HIGHly appreciated.

email me at reedlinks@aol.com

Thanks

Reed
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 11:22 AM
selwonk selwonk is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Hi

This should work:

Code:
<%
	str_Values = Request.Form("Values") ' Collect the form value
	ary_Values = Split(str_Values," ")  ' Split by space

	str_Field1 = ary_Values(0) ' Collect and store each array value
	str_Field2 = ary_Values(1)
	str_Field3 = ary_Values(2)
	str_Field4 = ary_Values(3)
%>
This should work if you have no more AND NO LESS than 4 values. What you need to consider is the changes in the number of data elements. You should then consider using the array values dynamically:

Code:
<%
	str_Values = Request.Form("Values") ' Collect the form value
	ary_Values = Split(str_Values," ")  ' Split by space

	For int_Counter = 0 TO UBound(ary_Values) ' Loop through array
		str_ThisField = ary_Values(int_Counter) ' Collect each array element
		DoSomethingWithThisValue(str_ThisField) ' Process the received value
	Next
%>
One thing to remember is that ASP does not support coercive variable names (i.e. variable names constructed from other variable names) which is a bit of a shame. In practise using arrays in the manner described will always prove quick and efficient

In regards to what you do with the data when you process it, we'd need to know more about your intentions

MK

Quote:
Originally Posted by Reed
Forms
Hello programmers... I have a question:

Can someone tell me/give me an example of how to do this:

In a form you might type in field1 something, say something like this:

"123456789 123456789 123456789 123456789"

is it possible to have an ASP form entry page parse the data into (4) four other fields automatically.

Like this:

filed1 entry = "123456789 123456789 123456789 123456789"

result:

field2 = "123456789"
field3 = "123456789"
field4 = "123456789"
field5 = "123456789"

the ultimate idea here is to have the user type data into one filed, field1, and after a certain amount of data entry, which would always be the same data length have that data parsed into the other fields as outlined above. Actually, data length may change but there could be a space in between, in other words a user may type in field one this for example "1 2 3 4 5 6 7 8 9, the 1 would be parsed into field two, 2 into field 3, etc. and so on.

The common element is the space in between the numbers.

Any help would be appreciated.

I assume that this could be done in two ways: all in one form or one page, my preferance, or done using multiple forms, not my preferance.

The database will be an access 2000 database.

Any help and code samples would be HIGHly appreciated.

email me at reedlinks@aol.com

Thanks

Reed
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
little help with jscript and forms funkeq JavaScript 3 11-08-03 08:50 PM
Using forms with auto increase column perleo PHP 3 10-11-03 05:37 PM
Passing a value between forms lordmerlin PHP 1 10-07-03 06:43 AM
FORM VALIDATION - CHECKBOXES: Driving me crazy!!! seala ASP 2 09-24-03 05:26 AM
Need Bravenet Alternative... bobby444 General HotScripts Site Discussion 10 07-17-03 10:36 PM


All times are GMT -5. The time now is 07:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.