Hi
I am struck with this problem .
i have 2 forms ..
Form A has 2 dropdown box
state :
city :
Form B
State :
City:
how to populate form B with the same values which the user selected in Form A
I would be very thankful .. if anyone can help me out
Thank You
21 2029
Welcome to TSDN!
If the form has an id, you can use - document.getElementById('formB')
to access form B.
In form B, what are State and City? Are they textboxes?
Post the HTML for both form A and form B.
Welcome to TSDN!
If the form has an id, you can use - document.getElementById('formB')
to access form B.
In form B, what are State and City? Are they textboxes?
Post the HTML for both form A and form B.
Hi
Thank you so much for replying
my sample code
home.htm
<form name="homePage" id="homePage" action="" method="post" >
<select id="month" name="month">
<option>jan</option>
<option>feb</option>
<option>mar</option>
</select>
</form>
user.htm
<form name="userPage" id="userPage" action="" method="post" >
<select id="month" name="month">
<option>jan</option>
<option>feb</option>
<option>mar</option>
</select>
</form>
wht ever the month the user selects in the Home.htm
that should be populated in the user.htm drop down box
these 2 different form are present in 2 different pages..
Please help me about the way i can solve this
Thank you so much
If they're on different pages, you'll need a server-side language to set the values.
You could possibly do this using cookies, but is it worth the hassle?
If they're on different pages, you'll need a server-side language to set the values.
You could possibly do this using cookies, but is it worth the hassle?
is there any way i can do using java script ??
Thanks You
How do you get from one page to the other? Are they linked in any way?
Read up on cookies here and here, so you know how to keep 'state' persistent over more than one page.
Of course, if cookies are disabled, you're a bit stuck.
Hi
Thank you so much for ur reply
I got this code at http://www.irt.org/articles/js063/index.htm
function load()
{
var passed = location.search.substring(1);
document.form2.month.value=getParm(passed,month);
document.form2.route.options.value = getParm(passed,year);
}
function getParm(string,parm)
{
var startPos = string.indexOf(parm + "=");
if (startPos > -1)
{
startPos = startPos + parm.length + 1;
var endPos = string.indexOf("&",startPos);
if (endPos == -1){endPos = string.length;}
return unescape(string.substring(startPos,endPos));
}
return '';
}
i am calling load() function when loading the form
PROBLEM IS THIS CODE WORKS FINE IN - " IE 7" BUT DOES NOT WORK IN - MOZILLA FIREFOX.. CAN YOU PLEASE TELL ME HOW CAN I USE IT IN MOZILLA FIREFOX
It would be of great help
Thansk u once again
Are you using the GET method?
ya ,i am able to get the values from the the form A in this form
http://www.irt.org/articles/js054/output.htm?city=value&state=qwerty
in form B i have parse this output statement which i get from form A and put the
first value i.e city value in text box
second value i.e state value in dropdown box
the above code as i said in my previous post works fine only in IE 7 , but not able to work in mozilla FireFox
I am not able to to figure out the reson .. could u please help me , how to make it work in mozilla firefox
Thanks a lot
Are you getting any errors in Firefox?
Hi
I am not getting any errors in FireFox , but this particular code is not working , i.e its not copying the data from Form A to form B
Can u plz , let me know the way i can solve this problem
Thanks
How are you accessing month and year?
Hi
from Form A i pass the values in the form of query
http://www.irt.org/articles/js054/output.htm?month=value&year=value
In Form B i parse these elements using the following code ,
function loading()
{
var passed = location.search.substring(1);
document.form2.month.value=getParm(passed,month);
document.form2.year.options.value = getParm(passed,year);
}
function getParm(string,parm)
{
var startPos = string.indexOf(parm + "=");
if (startPos > -1)
{
startPos = startPos + parm.length + 1;
var endPos = string.indexOf("&",startPos);
if (endPos == -1){endPos = string.length;}
return unescape(string.substring(startPos,endPos));
}
return '';
}
i will be calling loading function when i load the form
my form B looks like this
<body onload="loading()">
<form name="userPage" id="userPage" action="" method="post" >
<select id="month" name="month">
<option>jan</option>
<option>Dec</option>
</select>
<select id="year" name="year">
<option>2000</option>
<option>2100</option>
</select>
</form>
</body>
this is how i accress the elements
Please let me know if i am not clear
Thanks
i am able to work in IE 7 , but its not working in FireFox
month and year should be strings, i.e. "month" and "year" when passed to getParm.
yes , getparm function considers any character a-z and digits 0 - 9
Thanks
No, I mean the variables month and year should be strings unless you are defining them so somewhere else.
See your code: - function loading()
-
{
-
var passed = location.search.substring(1);
-
document.form2.month.value=getParm(passed,month);
-
document.form2.year.options.value = getParm(passed,year);
-
}
Line 4 should be: - document.form2.month.value=getParm(passed,"month");
I am really sorry , when copying the code i missed the quotes .
what u said is correct , i missed the quotes
function loading()
{
var passed = location.search.substring(1);
document.form2.month.value=getParm(passed,'month') ;
document.form2.year.options.value = getParm(passed,'year');
}
this is the right code
really sorry for this confusion , but its not working in mozilla
Thanks a lot
main problem i am finding with mozilla is ..
function loading()
{
var passed = location.search.substring(1);
document.form2.month.value=getParm(passed,'month') ;
alert(document.form2.month.value);
document.form2.year.value = getParm(passed,'year');
alert(document.form2.year.value);
}
in the above function is i am able to get mnth valuue properly
but not able to get the year value ..
alert(document.form2.month.value); ... gives me January
alert(document.form2.year.value);...... gives me nothing ,, its blank
This is the problem i am having with mozilla .. plz suggest me , the ways i can proceed
Thanks a lot
Give your 'year' select options values, e.g.
[HTML]<option value="2000">2000</option>[/HTML]
Give your 'year' select options values, e.g.
[HTML]<option value="2000">2000</option>[/HTML]
Hi
I have given that already
Thanks
I have given that already
You hadn't in post 13. Ok, what is the value of passed (the location.search string)?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chand |
last post by:
Hello Everyboy
I am creating a small scale db with following fields in the table and
form for the data entry purpose.
Product ID Product Name Manufacturer
Location
101 ...
|
by: Yul |
last post by:
Hi,
We are in the process of designing an ASP.NET app, where a user will
enter some 'Customer ID' to be queried in the database. If the ID is
valid, several stored procedures will be called to...
|
by: Flanman |
last post by:
I have an ASP web form that I want to populate fields based on the first
field choice. Example I have 4 fields item, price, delivery, availability. I
have all these items setup in an access table....
|
by: vj |
last post by:
How i can populate all fileds dynamically in jsp page based on contents
found in xml file?
I have written jsp servlets and java class file.
i transferred automatic data from jsp to servlet then to...
|
by: vijendra |
last post by:
How i can populate all fileds dynamically in jsp page based on contents
found in xml file?I have written jsp servlets and java class file.
i transferred automatic data from jsp to servlet then to...
|
by: dmeyr |
last post by:
Hello,
I am new to Access and am having difficulty with a Dlookup function. I have a form that I wish to autopopulate 10 fields with values based on two criteria which are also fields on the form....
|
by: joshua.nicholes |
last post by:
I have an access database that consists of two tables.A data
collection table and a species list table. The data collection table
has about 1500 records in it and the species list has about 600....
|
by: SimpDogg |
last post by:
Hey guys another Newbie here...
I have a combobox(JobName) on my form tied to a
table named (Jobs) with one field for all of the
jobs in the comboxbox. I want to auto populate the
Due Out Date...
|
by: whamo |
last post by:
I have the need to populate a field based on the selection in a combo box.
Starting out simple. (2) tables tbl_OSE_Info and tbl_Input;
tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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: 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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |