prototypejs

Passing a form object to a partial rendered from an ajax request

爷,独闯天下 提交于 2020-01-16 18:57:58
问题 I have an event form with some nested attribute models. The additional models are rendered after a client is selected from a select box. An observer watches and calls a controller action which renders a partial containing the fields_for nested models. The issue I'm having is that I can't pass the event 'form' block to the newly rendered partial - at least I can't figure out how... The code below raises the error: "wrong number of arguments (0 for 1)". Any help or suggestions are appreciated.

Stop Event in IE 9 (without upgrading to Prototype 1.7)

和自甴很熟 提交于 2020-01-15 15:14:49
问题 The site I'm working on uses Prototype 1.6.1. Its Event.stop() doesn't work in IE9. I know that Prototype 1.7 fixes the problem. However, is there a walk-around if I cannot upgrade to Prototype 1.7? I need the site to be compatible with IE 7, 8 and 9 (as well as Chrome, Firefox, etc). Thanks! EDIT: I tried event.preventDefault() and it doesn't work for me in IE 9. Here is an example: http://jsfiddle.net/garthcn/AdR7g/ It works in jsfiddle/Chrome/Firefox. If you paste the code to an HTML file

Stop Event in IE 9 (without upgrading to Prototype 1.7)

对着背影说爱祢 提交于 2020-01-15 15:11:48
问题 The site I'm working on uses Prototype 1.6.1. Its Event.stop() doesn't work in IE9. I know that Prototype 1.7 fixes the problem. However, is there a walk-around if I cannot upgrade to Prototype 1.7? I need the site to be compatible with IE 7, 8 and 9 (as well as Chrome, Firefox, etc). Thanks! EDIT: I tried event.preventDefault() and it doesn't work for me in IE 9. Here is an example: http://jsfiddle.net/garthcn/AdR7g/ It works in jsfiddle/Chrome/Firefox. If you paste the code to an HTML file

Stop Event in IE 9 (without upgrading to Prototype 1.7)

守給你的承諾、 提交于 2020-01-15 15:11:47
问题 The site I'm working on uses Prototype 1.6.1. Its Event.stop() doesn't work in IE9. I know that Prototype 1.7 fixes the problem. However, is there a walk-around if I cannot upgrade to Prototype 1.7? I need the site to be compatible with IE 7, 8 and 9 (as well as Chrome, Firefox, etc). Thanks! EDIT: I tried event.preventDefault() and it doesn't work for me in IE 9. Here is an example: http://jsfiddle.net/garthcn/AdR7g/ It works in jsfiddle/Chrome/Firefox. If you paste the code to an HTML file

PrototypeJS get value of each input

ぐ巨炮叔叔 提交于 2020-01-15 05:15:06
问题 I write following function to read inputs from my fieldset , it works but I have no idea how to read value of selected this way input $$('#split_edit div label input').each( function(item) { console.log(item); } ); This is my html structure, I can't read input value using its ID because they are dynamically generated. <fieldset id="split_edit"> <div class="top-10"> <label> <span class="span-3 left">Item 1 (%)</span> <input type="text" class="text" name="packet_1" value="0" id="packet_3"> <

What is the best field validation plugin for Prototype?

牧云@^-^@ 提交于 2020-01-14 06:09:05
问题 Not wanting to re-invent the wheel or anything, I was wondering if there's a plugin out there a field or form validation plugin that works with Prototype that you can recommend from your own experience and why? 回答1: I like Ben Keen's Really Simple Validation component. Features I like: All the validation rules can be kept within javascript so you're not adding class="required" to your HTML code. You can display error messages in a javascript alert box or with HTML text. Adding your own

Ajax GET requests: use parameters or put data in URL?

落花浮王杯 提交于 2020-01-13 08:11:08
问题 What's the advantage of passing data as parameters vs part of the URL in an Ajax GET request? Using parameters: var ajax = new Ajax.Request('server.php',{ parameters: 'store=11200&product=Meat', onSuccess: function(myData){whatever} }); Using URL: var ajax = new Ajax.Request('server.php?store=11200&product=Meat',{ onSuccess: function(myData){whatever} }); 回答1: One advantage to using the parameters argument is that you can pass it a Hash -like object instead of as a string. (If you do this,

Ajax GET requests: use parameters or put data in URL?

南楼画角 提交于 2020-01-13 08:10:08
问题 What's the advantage of passing data as parameters vs part of the URL in an Ajax GET request? Using parameters: var ajax = new Ajax.Request('server.php',{ parameters: 'store=11200&product=Meat', onSuccess: function(myData){whatever} }); Using URL: var ajax = new Ajax.Request('server.php?store=11200&product=Meat',{ onSuccess: function(myData){whatever} }); 回答1: One advantage to using the parameters argument is that you can pass it a Hash -like object instead of as a string. (If you do this,

How to submit Jenkins job via REST API?

痴心易碎 提交于 2020-01-11 04:09:05
问题 The following 'Execute system Groovy script' Build Task updates the build's description to add a button that will submit another Jenkins job which is parameterized: import hudson.model.Cause import hudson.model.Job import jenkins.model.Jenkins final JOB_NAME = 'my-job' final jenkins = Jenkins.instance final job = jenkins.getItemByFullName(JOB_NAME, Job.class) final currentBuild = Thread.currentThread().executable final buildNumber = currentBuild.getNumber() job.builds .findAll { build ->

Jquery and prototype noconflict

孤人 提交于 2020-01-06 07:29:05
问题 I got an conflict between jquery and prototype. HTML <!DOCTYPE html> <html> <head> <title>Nor-Avetisyan</title> <link rel="stylesheet" type="text/css" href="views/css/style.css" /> <link rel="stylesheet" href="views/css/calendarview.css"> <script src="views/js/jquery-2.0.1.min.js"></script> <script>jQuery.noConflict();</script> <script src="views/js/prototype.js"></script> <script src="views/js/calendarview.js"></script> <script> function setupCalendars() { // Embedded Calendar Calendar.setup