prototype

How to select the first child form element (using prototype)?

I want to set focus on the first form element in a div, either using something that Prototype gives me, or plain javascript. I have a reference to a div which contains the form elements. I don't know if the first form element will be an <input>, <select>, or <textarea> node. I want to do something like this: $('parentDiv').down('text...

Stopping Effect.ScrollTo() while it's scrolling?

Yeah, basically I have this: Effect.ScrollTo("bottom", { duration: 5.0 }); So what I want is to stop this effect while it's scrolling whenever I want to. Any help? ...

document.viewport.getHeight() inaccurate?

OK, regarding... the demo of Scriptaculous' Effect.Move which can be found here <style type="text/css"> a#move_demo { background:#fa0000; color:#fff; padding:5px; border:1px solid #000; } </style> <div class="demo"> <a href="#" id="move_demo" onclick="new Effect.Move(this, { x: 60, y: -30 }); return false;">Click me for a demo!</a>...

Prototype Ajax update

I am using AJAX and Prototype. In my code, I need to update the contents of a div. My div: <div id="update"> 1. Content_1 </div> My code: Element.update($("update"),"2.Content_2"); Expected output: <div id="update"> 1.Content_1 2.Content_2 </div> How can I do this in AJAX and Prototype? ...

XHTML/CSS/Javascript way to make a TABLE COLUMN selectable?

I am using a simple TABLE to display tabular data where the rows need to line up but when it comes to selecting the table contents, I only want users to be able to select within each column. Default browser behaviour is to select as rows across all columns but we NEED somehow allow selection only within columns. I was hoping there was a...

How does __proto__ differ from constructor.prototype?

Hi, if I have: function Gadget(name, color) { this.name = name; this.color = color; } Gadget.prototype.rating = 3 var newtoy = new Gadget("webcam", "black") newtoy.constructor.prototype.constructor.prototype.constructor.prototype it will returns always the object with rating = 3 but if I do newtoy.__proto__.__proto__.__prot...

Prototype and jQuery interference

I have a lot of jquery code and a little .js script that use prototype The problem is when i try to call the $$ method in prototype i got the error : $$ is not define So i like to know the long hand method to get the $$ work $$('table.'+triggerClass).each(function(t){ is there a way to force that part of the code to use prototype, a...

Can this snippet of Javascript be simplified more with jQuery?

I have the following snippet of Javascript, which is just attaching an onclick to a button and then updating the text of an em tag underneath it. I'm slowly trying to educate myself and work with jQuery more as I've found to like the syntax a lot more and for some tasks, it's more of a pleasure to work with. Some of the best examples I...

scriptaculous ajax autocomplete empty response

I’m working with the ajax-autocompleter which works great. My aim is to redirect between an editing function for an existing item, or a creating function for a not-found item. I insert a specific id to each li, and I can therefore use it for the editing function with an afterUpdateElement option. But if no results are found, the list i...

Where to put code that defines prototypes for base types in flex?

I've added functions to the Date prototype and I am wondering where is the best place to put the code in a Flex project? ...

In Side the ajax response light box effect using prototype.js

This is the Main page where I am calling a light box link using ajax submit. But I am not getting the light box effect after ajax responce.. index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html> <head> <title>Doubt</title> <!-- CSS for Light Box --> <link rel="stylesheet"...

jQuery and Prototype conflict

I am trying to use both jQuery and Prototype at the same time. I've spent hours and hours searching solutions to fix this problem. The most common method I found is this http://docs.jquery.com/Using_jQuery_with_Other_Libraries. However, it didn't work no matter how I place the "jQuery.noConflict()" code. Can anyone help me with this? ...

How to increase Zend Framework learning speed?

A preamble: I've been using PHP for over 8 year every now and then, but never used a framework, only wrote scripts and addons. Mostly I used code generators like CodeCharge Studio or custom code for intranet apps. Since I am ok with design patterns, Zend framework doesn't look too hard for me to learn. Starting with ZF: I've a read the ...

Downloading CSV via AJAX

Can you use AJAX to download a generated csv file from a web application? If so does anyone have any kind of reference that I could be pointed towards? EDIT: Sorry I should have mentioned I am using Prototype's Ajax.Request and I looked in firebug's response tool and the generated CSV is the response, I just need to get it to pop up wit...

Javascript - Getting 'undefined' when trying to get array's prototype

I think its a 5am brain drain, but I'm having trouble with understanding this. obj = ['a','b']; alert( obj.prototype ); //returns "undefined" Why isn't obj.prototype returning function Array(){ } as the prototype? It does reference Array as the constructor. ...

prototype.js 1.6.0.3 Ajax.Updater not working in IE7 or IE8. Help Please!

This works on all other browsers...but fails on IE7 & IE8. Help Please! <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <script src="/javascripts/prototype.js" type="text/javascript" charset="utf-8"></script> </head> <body> <input type="button" value="Ajax Test" onclick="var myAjax = new Ajax.Updater(...

Javascript: extending map objects

I don't know how to extend the map object with prototype and hope you can help. I have something like this: var map = {'one':1, 'two':2}; and I would like to have a method to check for the existence of a key: if (map.containsKey('one')){...} How would I extend the map object? ...

I want to delay a Prototype AJAX form submit??

Here is my code: Event.observe(window, 'load', function() { Event.observe('form_post', 'submit', function(){ new Ajax.Updater('Posts', 'getPosts.php', { }); }); }); I just want to delay the call to Updater, any ideas?? Thanks ...

Executing javascript code upon the load (and inside) of a javascript Modalbox

Hi, What i'm exactly trying to do is make my script.aculo.us Autocompleter work for my form when it is loaded inside a Modalbox object. Of course, i've tried my Autocompleter when loading the form as standalone and it works just as expected. For reference, here is my JS code loading the feature: Event.observe(window, 'load', function...

How can I integrate Prototype and jQuery with Scriptaculous?

I have been using jQuery and I need to use Scriptaculous and Protoype. I have tried using the jQuery library extending another library. I defined it using the following syntax: jQuery.noConflict(); jQuery(document).ready(function() { }); My jQuery works properly and I have divided the three modules. I need to have all three modules o...