• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax.Updater not displaying

 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don't have a lot of experience with Ajax. Updater and I'm having trouble getting it to work.
I have a web application with select boxes for building, floor and room. When I select a building I want the appropriate floors to display in the floor select box. Similarly for rooms.
I have used Firebug to debug this and the Response statement is correct.
The problem is it is not displayed on the screen (the web page doesn't change).

My building_select.html:



My buildings.tt




My floors.tt



My .js funtion:



It is what expect, but it doesn't make it to the web page.
Any advice would be appreciated.

Thank you!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Firebug DOM inspector to see what the DOM structure is after the response is returned. From just a limited glance at your code I suspect that you may be trying to shove a select inside another.
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I did use the DOM Inspector and I don't see anything wrong, but the floor select box shows no floors:



Al
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't you be passing in the div id and not the select id to be updated?

Eric
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought I was:

<div id="divId_floor">

new Ajax.Updater('divId_floor', self_url, {parameters: 'rm=floors&building_seq='+buildingSeq, asynchronous: true});

I'm sorry, it must be something really obvious.
I just don't see it...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the DOM inspector showing the valid DOM structure that you are expecting?
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DOM shows no change in the div where the data is supposed to be inserted.
The same empty floor select box.
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what the DOM shows for the floor div:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Al Gateway:
The DOM shows no change in the div where the data is supposed to be inserted.
The same empty floor select box.

So Prototype isn't doing the update at all from the response?
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Prototype is not updating at all.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you create sample files that show this issue with the smallest footprint (and without .tt files). I could give things a try locally and maybe shake something loose.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you cached? Clear the cache and see if it works.

Eric
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is part of a bigger web application written in Perl and that uses CGI::Aplication and Template Toolkit.
So there is no issue with the cache.

Bear Bibeault, I'm not sure what kind of files you need.
I already posted the code that relates to the Ajax issues.
There is also Perl code that reads a database and feeds the .tt (template toolkit) files.
But I that code is working, for example I back get the floors for a certain building, as it can bee seen from the server Response.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want people to help, you need to be able to provide reproducible cases. Expecting people to set up Perl and tt just to help you is not all that reasonable. What I was asking for was a raw HTML and JS test case that demonstrates your problem that can be run locally for testing. Without that, only thought inspections can take place.

This is not a wasted exercise. In addition to making it possible for others to run the test case, I've often found that the act of trying to set up a minimal test case to reproduce the problem often results in unearthing the original problem itself.
[ May 06, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Al Gateway:
This is part of a bigger web application written in Perl and that uses CGI::Aplication and Template Toolkit.
So there is no issue with the cache.
Sorry, not getting that. Just because it's part of a web app using the tools you listed, how does that eliminate the possibility of cache issues?
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, not getting that. Just because it's part of a web app using the tools you listed, how does that eliminate the possibility of cache issues?


Because the application is redrawing a page every time, so I'm guessing caching is not the issue.
However, I did clear the cache and tested, I have the same problem.
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want people to help, you need to be able to provide reproducible cases. Expecting people to set up Perl and tt just to help you is not all that reasonable. What I was asking for was a raw HTML and JS test case that demonstrates your problem that can be run locally for testing. Without that, only thought inspections can take place.

This is not a wasted exercise. In addition to making it possible for others to run the test case, I've often found that the act of trying to set up a minimal test case to reproduce the problem often results in unearthing the original problem itself.


I understand, I'll try to come up with some files.
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's try this. I have an html file:



In order_services.js I have:



The URL for Ajax is calling my cgi application but that should just work remotely.
I mean, if you enter https://www1.umn.edu/cgi-bin/do?user=nts&prog=order_services_lim.cgi&rm=flo
ors&building_seq=216 in your browser you should see a select box with the floors for the 216 building.

In the first html file you should change the path to your prototype file.

Please let me know if I'm missing anything.

Thank you!
[ May 08, 2008: Message edited by: Al Gateway ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing I forgot to mention: Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read. Please see this for more information.

You can go back and change your post to add code tags by clicking the .
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just realized that https://www1.umn.edu/cgi-bin/do?user=nts&prog=order_services_lim.cgi is a secure application, so you can't get to it.
So I wrote a small .cgi script that read the building_seq and then prints it:



Then I changed the .html file to call the .cgi script:



This time I put the javascript insertFloors function in the html.
You only need to change the path to prototype.js
However, when I look at my .html file in a browser and select a building, I don't even get a response from the server anymore.
Any help would be greatly appreciated.
[ May 08, 2008: Message edited by: Al Gateway ]
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a previous message it sounds like you might not have Perl installed, but I thought you have to call some sort of script from Ajax.Updater, whether is Perl, or PHP, etc.
I don't know how else to simplify this.
Thanks for trying to help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax can "hit" anything that returns a response. For debug purposes a text file containing the text of a sample response that demonstrates the issue would work just fine.

(Yeah, I have Perl installed, but setting up a CGI environment is more work).
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A sample response would be this:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Prototype? I'll see if I can try to recreate this over the weekend.
 
Al Gateway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.4.0
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic