473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Dealing with nearly identical form data

I am going nuts trying to figure out the best way to handle my post data.
The user recieves row upon row of records each associated with a uniqueID.
Each record may contain 10 edittable fields. By default all fields are disabled.
He can enables the fields for the record he wishes to edit.
Each record may have multiple text, select and radio controls.

Upon submit I am only getting the data which needs to change - but thats where i get stuck. I wish you could post an array straight to vbscript, if so i would could use that as a guide [uniqueID] to loop through all my request.form elements and run an update sub on each in turn.

Currently I am appending each input control with the uniqueID.
So the server may recieve 6 request.form elements such as.
var1+uniqueID
var1+uniqueID
var2+uniqueID
var2+uniqueID
var3+uniqueID
var3+uniqueID
Of course the unique ID is also the primary key that I will use to specify WHERE during my MSSQL UPDATE.

Any advice on how I can intelligently process this dynamic data coming from the client back to the server is soooo greatly appreciated.
Oct 10 '06 #1
1 1365
So what i did yesterday isn't perfect.
I added a hidden field with a constant name.
The value of which is my unique id.
It's disabled by default (just like all the form elements) using javascript to enable the elements associated w/ particular recordset.
So when it gets posted since the hidden ID carrier has the same name it returns the values as a CSV string. My field names are all like fieldName1__<%=trans_ID%> (Notice the double underscores)
From there I go to some lengths to sync my data......

Expand|Select|Wrap|Line Numbers
  1. str_Trans_ID = Request.Form("v_Trans_ID")
  2. array_Trans_ID = Split(str_Trans_ID, ", ")
  3.  
  4. For each Trans_ID in array_Trans_ID
  5.  
  6. For ix = 1 to Request.Form.Count
  7.     v_field_name = Request.Form.Key(ix)
  8.     v_field_value = Request.Form.Item(ix)
  9. field_chars = Len(v_field_name)
  10. v_underscores = InStr(v_field_name, "__")
  11. if (v_underscores > 1) Then
  12. v_split_left_pos = v_underscores - 1
  13. Else
  14. v_split_left_pos = v_underscores
  15. End If
  16. v_split_right_pos = field_chars - (v_split_left_pos + 2)
  17. v_basic_fieldName = Left(v_field_name, v_split_left_pos)
  18. v_joined_Trans_ID = Right(v_field_name, v_split_right_pos)
  19.  
  20. if (Trans_ID = v_joined_Trans_ID) Then
  21.  
  22. 'Finally i get everything synced and in line ready for database entry
  23.  
  24. End If
  25. Next
  26. Next 
Is there a way more efficient/obvious way to accomplish this?
Thanks for your input.
Oct 11 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Fazer | last post by:
Hello, I have the following code: #!/usr/local/bin/python import cgi import Cookie C = Cookie.SimpleCookie() C = "f"
2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
3
by: john.enevoldson | last post by:
Hi, We have a significant (and increasing) number of identical databases spread over numerous servers (linux) and are finding it a pain making table changes since we are currently issuing the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.