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

accessing html input fields

I have an input field defined outside the <formarea. Its a simple html
text input that is used to enter the number of hours.

<input id="HoursField" name="hours" type="text" />

I want to access this field from the server side (c# code). I tried these
two methods to access the field but they dont work. Please help.

String[] tempArray;
tempArray = Request.Form.GetValues("hours");
Response.Write (tempArray[0]);

---

string val = Request.QueryString["hours"].ToString();
Response.Write (val);
Jessica
Jul 4 '06 #1
2 1884
Jessica Weiner wrote:
I have an input field defined outside the <formarea.
By doing so, you don't pass the name/value pair of that <inputelement
to your gateway program, so there is no way to read it out. (but then,
why on earth would one want to place it outside the form if you need it
to reach the server?)
[...]
Hope this helps,

--
Bart

Jul 5 '06 #2

Jessica Weiner написав:
I have an input field defined outside the <formarea. Its a simple html
text input that is used to enter the number of hours.

<input id="HoursField" name="hours" type="text" />
If it absolutely necessary to place input out of the form you can
achieve your goal by adding input field dinamically to the form
directly before posting the form to the server.

at client side:

<script type=text/javascript>
function SubmitHours()
{
document.forms[0].appendChild(document.getElementById('HoursField') );
document.forms[0].submit();
}
</script>
.....
<input id="HoursField" name="hours" type="text" >
<input type="button" value="Post Hours" onclick="SubmitHours()">
.....
at the server side in Page_Load:

if (Request.Form["hours"] != null)
{
string s = Request.Form["hours"];
//.........
}

Jul 5 '06 #3

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

Similar topics

2
by: Christopher Johannsen | last post by:
Good Day: I am working on building a tool Using ASP/COM & IIS5.1 for a non-administrative technical support team to change domain passwords for users. I have the basic interface built and...
4
by: dmiller23462 | last post by:
I'm trying to create a submission page for users to request PC/LAN Access....If they select "Yes" in the field asking about if they need Non Standard Software, I want several other HTML fields to...
3
by: rockoyster | last post by:
Not sure if this is entirely a CSS issue but I have defined the class below in CSS. If I am stretching the friendship then I apologise in advance. I am trying to write a javascript script to...
6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
5
by: stellstarin | last post by:
I have a html where fields are created and added dynamically on the client side. I use the AppendChild() call to create fields dynamically. On submit i try to get the value for all the...
7
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.