473,944 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

input from a web form

Hi,

I try to get some input from a web form using the POST method, but
somehow with my code the variables are never empty.

My form:
<form class="specs" method="post" name="Form" action="WebForm 1.aspx">
<div>Login: <input class="login" type="text" name="Login"></div>
<div>Password : <input class="login" type="password"
name="Password" ></div>
<input class="login" type="submit" value="Submit">
</form>

My C# code:
private void Page_Load(objec t sender, System.EventArg s e)
{
Hashtable xsltParams = new Hashtable();
Hashtable xsltObjects = new Hashtable();

String user;
if(Request.Form["Login"]=="")
{
Session["user"]=Request["Login"];
xsltParams.Add( "login",Request .Form["Login"]);
}
else{
xsltParams.Add( "login","guest" );
}

}

Thx in advance for yur advices, answers.

Regards,
Pierre

Nov 17 '05 #1
4 2021
"Pierre" <bu****@no-log.org> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
I try to get some input from a web form using the POST method, but
somehow with my code the variables are never empty.


1) Stop and start the webservices (pop a command window and run iisreset) -
what are the values when the page opens for the very first time after that?

2) Currently your Page_Load code will run every time the page loads, not
just when the user clicks the submit button. You need to run it only when a
postback occurs e.g.

private void Page_Load(objec t sender, System.EventArg s e)
{
if (Page.IsPostBac k == false)
{
// maybe clear out the textboxes
}
else
{
// run your login code
}
}
Nov 17 '05 #2
ok thx that works now.

Just a new problem: if I have the code below, it seems I dun even read
the variable anymore (like I would not postback when I click on
submit).

if (Page.IsPostBac k == false)
{
xsltParams.Add( "login","Guest" );
}
else
{
if(Request["Login"]=="")
{
xsltParams.Add( "login","Guest" );
}
else
{
String login=Request["Login"];
Session["login"]=login;
xsltParams.Add( "login",log in);
}
}

Nov 17 '05 #3
"Pierre" <bu****@no-log.org> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
ok thx that works now.

Just a new problem: if I have the code below, it seems I dun even read
the variable anymore (like I would not postback when I click on
submit).


So put a break point in the if(Page.IsPostB ack == false) line and see what
is happening...
Nov 17 '05 #4
yeah that's what I thought, when I click on submit, it all comes back
to

Page.IsPostBack == false

same thing when I click on a link like ?nav=home

I really don't know how to make this postback working.

Nov 17 '05 #5

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

Similar topics

3
2580
by: david | last post by:
HI! Im trying to make "HTML form" into automatic. 1. If I get 18 numbers like: A B C D E F . . . . 2. How can I put those 18 numbers automatically into 6 numbers format like: A B C D E F
3
12949
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input type=submit value='Done'> </form>
12
2333
by: Randell D. | last post by:
Folks, I have a form called "ourTestForm". Its a test form - nothing special - it contains five input tags - they are named one, two, three, four and five. The input tags are of type text,text,radio,checkbox and select. When I run the following code, it correctly reports "text" (for input
6
4398
by: Dennis Allen | last post by:
Hi. I got a checkbox in a form. When the form is submitted, an email is generated. In the email text is the field name: on or off. The client doesn't want to see on or off, but yes or no. Question. Before I submit the form, is it possible to change the input from checkbox to text? If it was checked, have the value Yes, otherwise No?
3
4025
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table with a createElement function to add additional entries. The table has the first row of input text boxes already in it. You have to click a button to add another row. That seems to be working fine. How do I pull the information from the input boxes...
18
25034
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin, that IE7 does not seem to offer any way to control the font size of a text input element.
1
4019
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. Depends on the pull down list selection, I use script.aculo.us to validate the user input before submit and pass the necessary data, such as contact type, contact information and ranking to a php program for updating. This form should allow multiple...
2
3653
by: Abneo | last post by:
Hi all, I am very new to Javascript and I am in some need of some help. I am creating a site that has a madlib. I got the madlib code but now I want the results of the madlib to display in another frame. The user input will be in one from and the output should be in seperate frame. I have written the code for the madlib but when I hit the submit button it does not do anything. Here are my codes for the pages. The frameset code is ...
1
1845
by: tcertain | last post by:
I am totally duh at javascript although I have 2 books trying to learn it. I am trying to add values to a form and have a calculate total at end. this is my form script. I have hours at end of each radio or checkmark. (If this is checked, add these hours. ) I want to calculate total at the calculate button at the bottom of the form and have a window that shows the total. please excuse the long form, but with all the different...
2
1557
by: poreko | last post by:
I am trying to validate the inputs of a form using javascript. The validation is working but the form is not been submitted after the inputs have been checked. I have been unable to find any error. Any help will be appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>FORM</title>
0
10147
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9973
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11310
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10677
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7399
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3520
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.