ASP Post Question

E

Ed Richter

Wondering if theres a way to pass a hidden field on to next page using the post command??

I have a form where one of the fields is called ID_num. I don't want to allow people to change their ID, so I display it on the form, but in a non-editable display. <% = rsObj("ID_num") %> (not in a form field)

The person can edit other fields as needed, then presses the submit button. I want to then update the database for that record WHERE ID_num = Request.Form("ID_num") Problem is becasue I never had a form field for ID_num, it won't pass that field. I tried adding that field as a hidden field, but still won't seem to pass it.

I've done this before, using a hidden field, but was using a get command (rather than post) to pass the variables to the page that updated the database. The get worked, but can't make this work.

Any ideas??
 
K

Ken Ford - PVII Support

You need a hidden field in your form that looks like this:

<input type="hidden" name="ID_num" value="<%= rsObj("ID_num") %>">

--
Ken Ford
PVII Support Team
http://www.projectseven.com


Wondering if theres a way to pass a hidden field on to next page using the post command??

I have a form where one of the fields is called ID_num. I don't want to allow people to change their ID, so I display it on the
form, but in a non-editable display. <% = rsObj("ID_num") %> (not in a form field)

The person can edit other fields as needed, then presses the submit button. I want to then update the database for that record
WHERE ID_num = Request.Form("ID_num") Problem is becasue I never had a form field for ID_num, it won't pass that field. I tried
adding that field as a hidden field, but still won't seem to pass it.

I've done this before, using a hidden field, but was using a get command (rather than post) to pass the variables to the page that
updated the database. The get worked, but can't make this work.

Any ideas??
 
E

Ed Richter

That makes sense. I didn't have the rsObj part in the hidden field. I
had originally just had: value="<%= ("ID_num") %>"

Still though not working. When I pass to the page that contains the update
query, get the following error:

Syntax error (missing operator) in query expression '(ID_num = , 17)'.
Somewhere it's picking up the comma?? No where in my page is it obvious
where this comma is coming from though? It'd not in the actual ID_num
field

As a test, instead I changed the ID field to a normal form field and
eliminated the hidden field totally. Then everything worked fine. As soon
as I delete the form field and add the ID back as hidden field, get his
error. Doing that kind of verifies that the actualy ID field is OK, but
someplace else it's picking up this comma?



Ken Ford - PVII Support said:
You need a hidden field in your form that looks like this:

<input type="hidden" name="ID_num" value="<%= rsObj("ID_num") %>">

--
Ken Ford
PVII Support Team
http://www.projectseven.com


Wondering if theres a way to pass a hidden field on to next page using the post command??

I have a form where one of the fields is called ID_num. I don't want to
allow people to change their ID, so I display it on the
form, but in a non-editable display. <% = rsObj("ID_num") %> (not in a form field)

The person can edit other fields as needed, then presses the submit
button. I want to then update the database for that record
WHERE ID_num = Request.Form("ID_num") Problem is becasue I never had a
form field for ID_num, it won't pass that field. I tried
adding that field as a hidden field, but still won't seem to pass it.

I've done this before, using a hidden field, but was using a get command
(rather than post) to pass the variables to the page that
 
T

Thomas A. Rowe

Make sure you do not have a second field on the form of the same name.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
E

Ed Richter

Yup, that was the problem. Had both the hidden field and the non-form
field. Got rid of the one and works.

Thanks!
 

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

Top