473,405 Members | 2,334 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,405 software developers and data experts.

Ajax question, multiple fields...

Hi there our developer is creating a website in Ajax.

In one page we have the following fields.

Country:

City/State:

International Code:

We requested for him that when the country is selected then the city and international code to be updated automatically ...

He implemented that for the city but he says that he cant do it for both ..and that in ajax you can call only one page at the time ..

so essentially he says that i have to choose only one field either city to be populated automatically when i select the country or int code but not both...

Is there a way to overcome this limitation ?

Can you please provide me with a small snippet of code of how this can be done .?

Thank You
Aug 31 '07 #1
5 2098
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

it is not quite clear to me what the problem really would be. could you explain the dependencies in more detail? what would you expect when you choose a country ... please give a textual example. besides that ... when there are no logical restrictions you may call as much dependend data as you want with ajax ... so please give the example.

kind regards
Aug 31 '07 #2
Hi and thanks for welcoming me all of the fields are dropdown except the int code which is an edit box ..

Country(dropdown)

Citry (dropdown)

Int Code [edit box]

When country is selected e.g UK i would like to get the avalable cities e.g
London , Bedford , Oxford etc in the city field ..

and also in the int code to get the code 0044

If usa is selected i would like to get all the state names in city (i would actually like the text also to change to state)

and the int code to be 001 .

I am not sure about what the restrictions are but our developer says that this is nto possible to be done for both ....

I can get back to you with more info if needed .

Thanks again :-)
Aug 31 '07 #3
gits
5,390 Expert Mod 4TB
ok ... in case he says so ... it must have other reasons than the dependency logic ... let me give you an idea:

you choose UK ... send the request to the server and you do two things:

1. select all cities for UK
2. select the int_code for UK

put it in a response-string (probably json/xml) and send it back to the client that evals it and may populate the two fields with the received data.

even when there is only a restriction to make one call (for any reason) you may handle it as follows:

1. select all cities for UK

send back the response ... process it as shown ... and simultanuosly send the next request:

2. select the int_code for UK

get the response and process step two ...

kind regards
Aug 31 '07 #4
markrawlingson
346 Expert 100+
He can parse this data on 1 page and does not need 2.

When a country is selected, and he subsequently calls the server page - he can generate the drop down content for the citities, and attach the int code at the beginning.

like so...

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Response.write intCode& " " & sCityList
  3. %>
  4.  
The intCode as well as the list of cities will be returned to the first page, with the intCode attached to the first. Then all you have to do is parse the data. Namely, to split the data.

Expand|Select|Wrap|Line Numbers
  1. var response = http.responseText
  2. var response = response.split(" ")
  3. //response should now be an array containing the int code at index 0
  4. document.getElementById("yourIntbox").value = response(0)
  5.  
I used this method similarly 6 months ago to create an input system where a user could input a pre-dinfed 6 digit hex code, and onkeyup, if the key was found - it would locate their information in a database, and automatically fill out an entire registration form for them, including over 20 fields.
Aug 31 '07 #5
pbmods
5,821 Expert 4TB
Heya, Panos. Welcome to TSDN!

You can send as many AJAX requests as you'd like. You can even have more than one active AJAX request at any given time.

I'm not sure what your developer is talking about. Perhaps he is mistaken, or perhaps the way he implemented it, you can't run more than one AJAX call per page load (in which case, I'd get on him to find out how to fix that!).
Aug 31 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Steve | last post by:
I need to build a very dynamic client and would be interested in knowing the pros and cons of using JSF and Ajax to accomplish this. Thanks. Steve
1
by: AndiSmith | last post by:
Hi guys, I wondered if anyone could help me with this problem, or even shed some light on the direction I need to take to resolve it? I'm using .NET 2.0 (C# flavor) to build a large user-based...
3
by: markus.rietzler | last post by:
i want to do (multiple) file upload(s) and display a progress bar. with firefox and safari it is no problem at all. only IE makes some problems. my script is based on ajax-uploader, which can be...
2
by: groups2 | last post by:
I am fixing up a site where the address data for all the addresses for each customer is called with 1 query and then added to a javascript array. The street name of each shipping addresses is...
0
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along...
18
omerbutt
by: omerbutt | last post by:
AJAX PROB WITH MULTIPLE RECORDS helo iam having problem in ma code will any body look out an help, i am trying t add sale record in the database and the checkthe quantity of the part slod and...
5
by: BM | last post by:
I have a question that seems like it should have a simple answer, but I can't seem to find it by searching... Anyway, I'm trying to capture the IsPostBack event when I select an item within an...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
8
omerbutt
by: omerbutt | last post by:
hi there i have a form with multiple input (type/text ) fields and three inputs(type/file) fields i have to submit the form via ajax because i have multiple forms on this page ,you can say it is a...
0
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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...
0
Oralloy
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,...
0
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...

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.