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

retrieving information from form

hello all, i am having some difficulty retrieving information from my
form. I want to add content in my table but the content i want to add
to the table is what the user inputs in my form.

Basically i want to know how i retrieve information from the form so i
can disaply it in the table.

i have put the code i am using below, the feature i cannot get to work
is the change content function. I want the email address entered by
the user,if the change content button is clicked it copies the email
address in the the top of the table.

Below is the code i am using:

<html>
<head>
<title>retrieve information from form </title>

<script type="text/javascript">
function changeContent()
{
var x=document.getElementById('myTable').rows[0].cells
x[1].innerHTML=document.getElementById('test.emailaddr ess')
}
</script>
<style type="text/css">
strong {font-weight:bolder;
color: powder blue;
font-style:Minion;
font-size:50%};
</style>
<head>

<body>
<h1Worldcup Groups <h1>

<table id="myTable" border="1">
<tr>
<td>Game1</td>
<td>India</td>
</tr>
<tr>
<td>Game2</td>
<td>Pakistan</td>
</tr>
<tr>
<td>Game3</td>
<td>Sri Lanka</td>
</tr>
</table>

<formname = "test">
<p>
<label>Email Address:
<input type = "text"value="e.g. je*********@brunel.ac.uk" name =
"emailaddress" size = "35" maxlength=
"35"/>
</label>
</P>

<input type="button" onclick="changeContent()" value="Change content">
</form>
</body>
</html>

Mar 24 '07 #1
2 1983
On 24 Mar, 13:00, 4An...@gmail.com wrote:
hello all, i am having some difficulty retrieving information from my
form. I want to add content in my table but the content i want to add
to the table is what the user inputs in my form.

Basically i want to know how i retrieve information from the form so i
can disaply it in the table.

i have put the code i am using below, the feature i cannot get to work
is the change content function. I want the email address entered by
the user,if the change content button is clicked it copies the email
address in the the top of the table.

Below is the code i am using:

<html>
<head>
<title>retrieve information from form </title>

<script type="text/javascript">

function changeContent()
{
var x=document.getElementById('myTable').rows[0].cells
x[1].innerHTML=document.getElementById('test.emailaddr ess')}

</script>

<style type="text/css">
strong {font-weight:bolder;
color: powder blue;
font-style:Minion;
font-size:50%};
</style>
<head>

<body>
<h1Worldcup Groups <h1>

<table id="myTable" border="1">

<tr>

<td>Game1</td>

<td>India</td>

</tr>

<tr>

<td>Game2</td>

<td>Pakistan</td>

</tr>

<tr>

<td>Game3</td>

<td>Sri Lanka</td>

</tr>

</table>

<formname = "test">
<p>
<label>Email Address:
<input type = "text"value="e.g. jesuschr...@brunel.ac.uk" name =
"emailaddress" size = "35" maxlength=
"35"/>
</label>
</P>

<input type="button" onclick="changeContent()" value="Change content">
</form>
</body>
</html>
what do you want to do this for? any changes made in this way, or
email addresses entered will be lost once the page is refreshed.
In order to save the data entered you need to use a server side
scripting language like php/python/ruby/perl etc... to save those
changes.

The thing you are doing at the moment, can be done using (although
there's no finesse and there are better ways)

<script type="text/javascript">
function changeContent()
{
var input = document.getElementById('enter_email');
var p = document.getElementById('email');

//add the email into the paragraph
p.innerHTML = input.value;

//if you just want to blank the input afterwards
// input.value = '';
}
</script>
<p id="email"></p>
<input type="text" id="enter_email" size="35" />
<input type="button" onclick="changeContent();" />

Mar 24 '07 #2
ASM
4A****@gmail.com a écrit :
hello all, i am having some difficulty retrieving information from my
form. I want to add content in my table but the content i want to add
to the table is what the user inputs in my form.

Basically i want to know how i retrieve information from the form so i
can disaply it in the table.
var myData = document.myForm.myInput.value;

with :
myForm = name of your form (not the id !)
myInput = name of your text field (not the id !)
i have put the code i am using below, the feature i cannot get to work
is the change content function. I want the email address entered by
the user,if the change content button is clicked it copies the email
address in the the top of the table.

Below is the code i am using:

<html>
<head>
<title>retrieve information from form </title>

<script type="text/javascript">
function changeContent()
{
var x=document.getElementById('myTable').rows[0].cells
x[1].innerHTML=document.getElementById('test.emailaddr ess')
That (getElementById) will not work with firefox because your form and
elements have not an id.
That will not work because you don't call the "value" of the field.

x[1].innerHTML = document.test.emailaddress.value;

x[1].innerHTML = document.forms['test'].elements['emailaddress'].value;

x[1].innerHTML = document.forms[0][0].value;
}
</script>
<table id="myTable" border="1">
<tr>

Take care of spaces in your code !
<formname = "test">
<form name="test">
<p>
<label>Email Address:
<input type = "text"value="e.g. je*********@brunel.ac.uk" name =
"emailaddress" size = "35" maxlength=
"35"/>
<input type="text" value="e.g. je*********@brunel.ac.uk"
name="emailaddress" size="35" maxlength="35"/>
</label>
</P>

<input type="button" onclick="changeContent()" value="Change content">
and why not :

<input type="button" onclick="changeContent()" value="Change content" />
</form>
</body>
</html>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 24 '07 #3

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

Similar topics

1
by: Dave Rams | last post by:
Can some one suggest an article on the saving and retrieving VB.net projects. I have lost complete programs at least twice. I have to reconstruct the programs. It has happened when I enter...
0
by: Brian Conway | last post by:
How can I code something to pull a particular cells information in a datagrid and assign it to a variable? I have a button that I want to user to click on, and when they do this it will pull the...
2
by: Sakke | last post by:
Hello! We have written a GCryptoSvr.dll COM server in C++. Inside that resides WebClient COM component. WebClient CLSID is {8DC27D48-F94C-434B-A509-C3E1A3E75B9E}. When we are using that...
1
by: Captain Dondo | last post by:
I am not really experienced in Javascript so bear with me.... I am working with an embedded platform; no mouse, no keyboard. Just up, down, left, right keys and +/- keys for...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
3
by: BOBss | last post by:
I have an .ASP page that comes up, and I am trying retrieve a variable from the previous .ASP page. However none of the variables from the previous .ASP page are available to the current .ASP page....
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
34
by: vpriya6 | last post by:
Hi guys, I am new to Ajax, xml and javascript. I want to know how can I retrieve data from xml and display in the html page? please help me out. suppose my xml file is customer.xml the code...
1
by: fidgen | last post by:
Hiya, I'm trying to get a AJAX driven update to my list of news articles, so when users click the title of the news article, it pops up the article content in a thickbox overlay. Retrieving...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.