View Single Post
Old 12-06-2010, 11:27 PM   #1
bxdobs
 
Join Date: Dec 2010
Posts: 3
Default Spry/Ajax/xmlhttp

As a programmer of 30+ years of micro code to oop experience, I thought I would have no problems jumping into a Web Project especially with the purchase of CS5. Wasn't expecting to get frustrated simply trying to dynamically fill several dependant list boxes from a server side SQL DB without having to reload the HTML page. The concept of dynamic loading appears to work as a one shot when the page loads the problem I am having is getting new data after the page is loaded.

Consider a set of 4 lists each dependant on the previous list ie Country, State, City, Address ... State is dependant on Country, City on State etc.

Reading SPRY advertising, it sounds as though SPRY should be able to do this with the provided library but I haven't found any related examples.

I understand the client/server requires an XMLHTTP object ... JS PUT/GET is required to initiate a call to the server side to trigger a PHP routine to pull data back to the client side.
HTML event -> JS fnc() -> AJAX -> PHP fnc() -> SQL -> PHP fnc() -> AJAX -> JS fnc() -> HTML object

With all the automatted code in DW I guess I was expecting not to have to get my hands dirty to do this? So far I still haven't been able to even get any of the AJAX/PHP/JS examples for doing table transfers to work for me using CS5 and XAMPP. Most of the examples I have been playing with are from w3schools.com

Scoured the net but didn't turn up any examples to dynamically fill a select box ... this usually means I am missing a concept ie its too simple to require an example ... or ... its beyond the scope of most DIY sites?

What I have figured out so far:
1) disable/enable an HTML <select> object

2) clear an HTML <select> object

3) load an HTML <select> object

What I need to still figure out
a) change HTML object focus

b) trigger a Server side call with the current select value
- I expect a <select onchange event> needs to trigger a JS function to do an XMLHTML object call to GET/PUT to trigger a Server Side PHP function which will do the SQL Select call

c) trigger a client side JS update function to populate, enable and focus the next <select> object with the returned Server side data.
- I expect this requires a a callback function

OR

Is there a SPRY method/procedure/libratry that can be used to generate all the necessary interlinking code.

I don't want to reinvent the wheel here ... I guess I expected Dynamic Data Exchange would be a basic functionality built in to any current web design tool.
bxdobs is offline   Reply With Quote