prototype

Getting innerHTML text from selected checkboxes in Prototype

Hi, I need to get the text from the selected checkboxes in a form. Ifhe form is: <form action="save" method="post" name="reunform" id="reunform" > <div id="listad"> <ul id="litemsd"> <li class="litemd"><input type="checkbox" name="d1" />Number One</li> <li class="litemd"><input type="checkbox" name="d2" />Numer Two</li> <li ...

Strategies to migrate from Prototype to jQuery (Rails)

Hello guys, I have an existing Rails App with considerable js code written using Prototype, I would like to make jQuery the default app's javascript framework and then migrate the existing Prototype code the jQuery's equivalent. What is your experience with this kind of issues or what strategies you suggest me in order to make this a...

How can I dynamically add a select element to a form using Prototype & Rails?

I have generated the code for a select & its objects using Rails: var insert_tag = '<select class="select medium" id="category_id" name="search[category_id]"><option value="-1">Select Category</option> <option value="1">Boats and Cruisers</option> <option value="2">Car Parts and Spares</option> <option value="3">Caravans</option> <optio...

General reasons not to deal with Document's and Element's prototype

Are there general reasons not to deal with Document's and Element's prototype? I like to create my own little framework, because my current project doesn't need the mass of features of the existing frameworks. I don't need to support browsers which don't support Element/Document-constructor and also will not execute scripts that are no...

fireContentLoadedEvent is being called prematurely in ie

I've got an issue that's only just started happening under ie8. my code has been working for some time, and still works fine in firefox but for some reason prototype just stopped calling my event listeners for dom:loaded. i attach them via document.observe("dom:loaded", callback); after some debugging (i hate ie's debugger!!!) i've com...

prototype 1.6 in openspace

Hi, I have set up a map using openspace which I believe uses, in part, prototype 1.4. It works, but when I try to add prototype 1.6.0 i get the error: Failed to load resource: the server responded with a status of 414 (Request-URI Too Large) its actually the url + the rest of the code appended to it. am i not able to use prototype &...

Undefined variable in array in prototype

Hi, I have the following code: <ul id="litemsd"> <li class="litemd"> <input type="checkbox" id="d1" name="d1" /> <label for="d1">Number One</label> </li> <li class="litemd"> <input type="checkbox" id="d2" name="d2" /> <label for="d2">Numer Two</label> </li> <li class="litemd"> <input type="checkbox" id="d3" name="d3" /> ...

Losing MouseUp event if releasing not over the same element

I have got a problem with a slider. When i grab the handler, i change the .src of the image, just to change its color. However, i want it to change back to the original color when i release the mouse button. I have tried two things. 1) Changing it back on the handler mouseup event: this works only if i release the button over the handle...

What are the benefits and dangers of adding methods to Object.prototype in Javascript?

I know this was a contentious issue five years ago, but I'm wondering if things have changed for today's JavaScript. Are there any real world examples of a major modern library being incompatible with extending Object.prototype? I'm not interested in hypothetical "someone may write bad for in iteration code in a library that you want to...

Not sure how to use jQuery noconflict function....

I've been working on this site for the past two weeks and everything has been running smooth until now. I have conflicting javascripts and all though I know what method to use to solve the problem (jquery noconflict), I have no idea how to use it! In my case, I have: a drop menu which uses the prototype js and a custom js and a conta...

Prototype > JQuery Conversion

Hi! I need to convert one script from Prototype to Jquery, but I'm no good with Jquery. If someone can do this, i will thank so much =) Here's the code in Prototype: // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults replace_ids = functio...

How to translate prototype's $A() function into jquery?

Hi chaps, I'm trying to translate Brandon Kelly's AC.VR class (Prototype) into a jQuery plugin. Here is a link to his example (unfortunately just working in Safari). I managed to get the basics working. The problem I'm having is the mouse event history for the velocity, acceleration and friction part of the script. Here is a shorten ...

Prototype: How to resolve parameters in Ajax.Responders.register

Hi at all, I am registering each Ajax call with Ajax.Responders.register of the Prototype framework. The idea was to render an Ajax Spinner if a request is open. But when a request only needs some millis, then I wouldn't show the ajax spinner. But therefore I need the parameters of the request to check for example a flag in the paramet...

How do I create prototypes in Javascript?

I trying to learn how to create prototypes in Javascript, but the Array prototype confuses me. I have an Array of Numbers that are stored in the Array as Strings, and I want to convert the entire Array so they are actual numbers. How do I do this an exactly what would I type to activate this prototype? ...

Stop page from scrolling when intercepting key presses like space and arrows

I'm using JavaScript and Prototype and catching the key presses from the user. I successfully catch return, space and arrows with code like this: Event.observe(window, "keyup", function(e) { switch (e.keyCode) { case Event.KEY_RETURN: case Event.KEY_RIGHT: case 32: // space // do something break; } }); My ...

Should I check for the class before adding or removing it in prototype?

I have a line of code in JavaScript, using prototype, that is run several times per second. This line of code, depending on the state of some variables, would ensure that certain element has or has not a class. My question is, should I blindly add or remove the class or should I check for it first? Should I have this code: if (!element...

Differentiating rows' elements in Prototype

Hi, I have a table that contains in each row an input and a "save" image. <td> <div id="acp_1" style="margin-left:100px;display: inline"> <input size="10" type="text" value="11:00" name="acpr_1" id="acpr_1" /> <span class="modify-listener" id="ml_1"> <img id="save_1" src="/images/skin/database_save.png" alt="modify"/> </s...

Ajax Updater in Gmaps v3 divcontrol not firing

Hi, I have moved from v2 my working solution in Gmaps v3. After add a map control using dom and divs elements i'm not able to Update my content calling one Ajax.Update method and passing the id. All elements are in Dom. regards. May be linked to :link text var idname ='s7'; //--> div id='s7' ajax = new Ajax.Updater( idn...

Magento product listing using ajax

Hi, I have to add 5 separate tabs like By category,our picks, most popular top rated, your favorites in home page itself and each of them should list out the products under that one without full page reloading. That is using ajax , is it possible in magento. If so please guide me on this. ...

field.up("fieldset") not picking up text area

Hi All, i have a validation problem, where my code is refusing to pick up a textarea. Error on var "fieldset = field.up("fieldset");" line: this.showErrorMessageForMissingFields = function (missingFields) { var missingFieldPlaceHolder = $("missing-fields"); var listOfFields = ""; var fieldsets = {}; for (var i = 0; i...