My problem seems like it should be easy, but I can't quite figure it
out. Would like to set the value of one of my HTML fields after the
submit button is clicked. In visual Basic I would say something like
Form1.field.value = X. How do I specify this in ASP? TIA for your
help.
Marc
Well, I guess you mean that on client side VBScript you want to change
the value of some input in the form just before submitting. This is
not related to ASP, this is basic HTML. You should use javascript to
allow the code to run in Netscape, and there is plenty of threads for
this, use google to search. (Quick tip: use
document.formName.inputName.value).
Now if you want to actually modify the values when they get on the
server, you simply have to use Request.Form("inputname"). All input
with a name properties in the submitted form will be available in this
collection.
I would strongly suggest that you take time to understand the
difference between client and server side (which is not so obvious
when you come from the VB world), because when you will get to .NET
this can become very, very confusing.
Nash.
Thank you for the help. You got me going in the right direction. I was
opening a recordset, grabbing the MAX ID and adding one, then
diplaying the "Request Number" when the form opened. Predictibly, I
had issues with concurrent users. I finally just got rid of the field
(since it was system generated) and set an application variable equal
to the returned record + 1 and inserted the application variable
instead of the form field value. Thank you.
Marc
In your case, why do you need the ID to be a simple integer? You could
build a string ID using the date (up to the 1/100 sec) and some
information coming from the client. Then you can use this ID in
whatever number of transactions are required with the client. Using a
rowcount is very likely to drive you insane.
Actually the application scope should never be used to store valuable
information (other than hit counters), because it is a killer on the
server but also because it force you to rely on persistent
connections. What happens if just after your client got the form for
some reason all connections are lost (firewall down, dhcp renew, etc)?
Your application variable is reset and when the client submit you can
get very nasty results.
Also using application variables prevents you from clustering you web
service (which is very difficult with IIS unless it is .NET).
This being said, a good practice is to never rely on media-specific
elements (such as application or session variables) when you want
integrity in a database, unless you control all possible issues which
is not the case here.
Guess why J2EE is so popular - it just handle all this stuff.
Good luck.
Nash.