Pulling TextFields from a Form

  • Thread starter Thread starter Rich Wahl
  • Start date Start date
R

Rich Wahl

Ok, This may sound like a noob question, but I have an application, that
asks the user to fill in fields from a pre-generated list of
possibilities. And upon clicking submit, the user is re-directed to a
page based off of their inputs into those fields.

Some of the code is

<form name="SomeForm">
<tr><td colspan="1"><img
src="default.aspx?uid=SomeID&coid=SomeOtherID&pgid=31&key=SomeKey"
alt="wonder if this shows up"><br><input type="textbox" name="SomeName"
value="This is an Answer"></td></tr>

<input type="button" value="Submit"
onclick="window.location.href=('default.aspx?uid=SomeID&coid=SomeID&pgid=32');"></input>
</form>

And once clicked, a new function is called.

But when I do a

Dim req As HttpRequest
sSQL.Append(req.Form("SomeName"))

I get a NullReference exception, as if it doesnt recognize the form, is
it because the Button was allready clicked? Or how can I pull the data
from the textfields, if im not actually posting them anywhere, just
using the Submit as a... 'move forward' in the process.

Thanks in advance for any help someone can offer.
 
The NullReferenceException is because your variable 'req' is not set to
anything. All you do is declare it. And right on the next line try to use
it. But you never actually set it to an instance of an object.

You should either use the current request object, or if you declared the
textbox as runat="server", you can just refer to the textbox by its name.
 

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

Back
Top