Save all values from a form

S

Sanjay

Hi,

Is it possible to save all the names/values of a form to another memo
textfield before a Insert to the database then when required on another page
split that memo textfield into the name and their corresponding values
retrieved from the recordset ?

Thanks,

Sanj
 
R

Ray Costanzo [MVP]

Of course it'd be possible, but why go through the extra process of joining
things together and then split them back up again?

Ray at work
 
M

McKirahan

Sanjay said:
Hi,

Is it possible to save all the names/values of a form to another memo
textfield before a Insert to the database then when required on another page
split that memo textfield into the name and their corresponding values
retrieved from the recordset ?


This will do (something like) it server-side:

<%
For Each item In Request.Form
memo = memo & item & "=" & Request.Form(item)
Next
%>

But it sounds like you want to do it client-side
to populate another form field; (i.e. <textrea>).
If so, that's a question for another newsgroup.
 
M

McKirahan

McKirahan said:
This will do (something like) it server-side:

<%
For Each item In Request.Form
memo = memo & item & "=" & Request.Form(item)
Next
%>

Below I added "& vbCrLf" to separate each field's name=value pair.

<%
For Each item In Request.Form
memo = memo & item & "==" & Request.Form(item) & vbCrLf
Next
%>


You would then use
item =Split(memo,vbCrLf)
to get each name=value pair then use
what = Split(item,"==")
to get each name and value from an item.

Of course you didn't indicate that you wanted the "name"
of each field just its "value". Adjust accordingly.
 
S

sanj

Thanks for replying, let me explain the reason for this first:

I have a form (1 form of 8) with approx 60 textfields, I need to save the
values which are returned from various recordsets and calculations using VB
when the page is executed. The user after completing all the forms the user
sets another value on another page (which could be completed a week etc)
which is inserted into a database, so my thought was to save all the values
from the form in a memo textfield in the database instead of creating a field
for each textfield, then after the user has set the other value split the
memo textfield and conduct the extra calculations required based on the
additional set value and resave the all to the database again.

This way I can keep the database small without creating all the fields in
the database for each form - I don't need to report/search on the values in
the memo textfield.

Your solution is perfect so thanks for this, could I ask one question:

e.g.
my memo textfield is like the following using your solution:
productID1==LB5284/3 productID2==6491B710G/Y productID3==KCL10-10

when I retrieve the value from a recordset I would like to using VB to:

productID1 = LB5284/3
productID2 = 6491B710G/Y
productID3 = KCL10-10


I'm trying to follow your split function by using Response.Write:

<%
item = Split(session ("memo"),vbCrLf)
what = Split(item,"==")
Response.Write(what)
%>

Regards,

Sanj
 
M

McKirahan

sanj said:
Thanks for replying, let me explain the reason for this first:

I have a form (1 form of 8) with approx 60 textfields, I need to save the
values which are returned from various recordsets and calculations using VB
when the page is executed. The user after completing all the forms the user
sets another value on another page (which could be completed a week etc)
which is inserted into a database, so my thought was to save all the values
from the form in a memo textfield in the database instead of creating a field
for each textfield, then after the user has set the other value split the
memo textfield and conduct the extra calculations required based on the
additional set value and resave the all to the database again.

This way I can keep the database small without creating all the fields in
the database for each form - I don't need to report/search on the values in
the memo textfield.

Your solution is perfect so thanks for this

You're welcome.

, could I ask one question:
e.g.
my memo textfield is like the following using your solution:
productID1==LB5284/3 productID2==6491B710G/Y productID3==KCL10-10

when I retrieve the value from a recordset I would like to using VB to:

productID1 = LB5284/3
productID2 = 6491B710G/Y
productID3 = KCL10-10


I'm trying to follow your split function by using Response.Write:

<%
item = Split(session ("memo"),vbCrLf)
what = Split(item,"==")
Response.Write(what)
%>

Try changing it a little:

<%
what = Replace(Session ("memo"),"=="," = ")
Response.Write("<pre>" & what & "</pre>")
%>
 
S

sanj

Yes that's great thanks again.

Regards,

Sanj

McKirahan said:
You're welcome.

, could I ask one question:

Try changing it a little:

<%
what = Replace(Session ("memo"),"=="," = ")
Response.Write("<pre>" & what & "</pre>")
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top