473,395 Members | 1,679 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,395 software developers and data experts.

changing a Form Variable

This may sound like a simple question but I really dont' know how to do
this.

I know you can call a Form Variable in a VBscript using
Request.Form("FieldName") and make equal a local variable like:

str = Request.Form("FieldName")

Now if do this:

str = "This is the new value"

How do you make FieldName equal str. So In a sense I want this to happen

FieldName = str

I need this so that when FieldName gets posted to the DB the new value get
sent.

Any ideas?
Jul 19 '05 #1
3 2750
I'm not really sure why you'd want to do this, unless you're trying to
dynamically create form field names, in which case, you'd do:

<% sVar = "SomeFieldName %>
<input name="<%=sVar%>" type="text">

You cannot reassign the names of the form elements when the form is posted.
The Request.Form collection is read-only.

Ray at home

"Alex" <Al**@noemail.com> wrote in message
news:O7*************@tk2msftngp13.phx.gbl...
This may sound like a simple question but I really dont' know how to do
this.

I know you can call a Form Variable in a VBscript using
Request.Form("FieldName") and make equal a local variable like:

str = Request.Form("FieldName")

Now if do this:

str = "This is the new value"

How do you make FieldName equal str. So In a sense I want this to happen

FieldName = str

I need this so that when FieldName gets posted to the DB the new value get
sent.

Any ideas?

Jul 19 '05 #2
In the updating to the database:
objRS("MyField") = str

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
If you open your database with the right kind of cursor, you can do the
update.

Do While not objRS.EOF
objRS("MyField")="new value"
objRS.MoveNext
Loop
objRS.Update

I prefer to use an UPDATE Sql statement, to make the changes
if objConn is my connection....

Dim sSQL
Dim newValue
newValue="new value"
sSQL="UPDATE tablename SET MyField='" & newValue & "' WHERE columnUniqueID=
X"
objConn.Execute sSQL
In this way you aren't pulling down a recordset just so you can do an
update.

If you need to display the "updated" data, just do the UPDATE first.

"Bullschmidt" <pa**@bullschmidt.com-nospam> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
In the updating to the database:
objRS("MyField") = str

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BjoernJackschina | last post by:
Hello, I have a page with different datas. One of them is recorded in a input text field. Thisone could be changed and so I need the new value in the same page which will be called after the value...
3
by: Emanuel Marciniak | last post by:
Hi all, We have the form which uses checkboxes for several fields and the target action points to outside webservice. Unfortunatelly they do not support checkboxes. How to pass it as a radio...
1
by: Young-Soo Roh | last post by:
Hi. I need to get simple script working. I have many select object. When I select a different option, I would like to change the value of corresponding text input field. How can I do this using...
8
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care...
3
by: Jeff | last post by:
Hi I have a report with a graph on it and want to change the minimum and maximum values for the value axis when it is previewed. This can't be done by adding code in the Open event as once the...
10
by: Altman | last post by:
I have only done a little programming in C++ so I am still learning but I am having a problem with a variable that is changing on me. I have tried this 2 ways with the same result. I have a...
2
by: John Dann | last post by:
In VB.Net I have a Form1 main form that instantiates various class objects. I want to change eg the title text of Form1 from within one or more of these classes. The solution kindly suggested...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.