[Proto-Scripty] Re: order matters? cannot get handle to div (null)
Hi, Are those calls to doUpdate really inline? If so, they're probably happening before the DOM is ready. I'd suggest wrapping them in a dom:loaded event handler[1] or one of the other mechanisms for making sure the DOM is ready before trying to do things with it. [1] http://prototypejs.org/api/document/observe HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jan 21, 11:42 pm, theG gurpal2...@hotmail.com wrote: When I hardcode a form into a div and try to get a handle on it via $ ('') it works. When I include the txt dynamically via an AJAX update() it doesnt: --JS function doUpdate(id, url) { new Ajax.Updater(id, url); } doUpdate('search', 'search'); doUpdate('menu', 'menu'); function doSearch(event) { new Ajax.Updater('menu', 'menu', { parameters: { txt: $('txt').value } }); event.preventDefault(); } function addObservers() { $('searchForm').observe('submit', doSearch); } Event.observe(window, 'load', addObservers); -form HTML Search form method=post id=searchForm style=display: inline input type=text name=txt id=txt size=20/ input type=submit name=btnSubmitSearch id=btnSubmitSearch value=Go!/ /form ---HTML-- body div id=search !-- stuff here either inserted via ruby ajax post OR hardcoded -- /div div id=menu /div /body -- Now I get $('searchForm') is null when i use doUpdate('search', 'search'); - gets it via ruby http post If however i comment out doUpdate('search', 'search'); and instead actually hardcode into the div I looked into defer() but it didn't help. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Element is null
A good night's rest made me see that I did not have an id attribute on the form element, just a name. My bad. That gets me sometimes when I am referencing form fields. By the way, the code is actually velocity, a little-known java template language. It was part of a project we ended up using a few years back and now we are stuck with it. On Jan 22, 3:18 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, The line: Event.observe('$formName', 'submit', checkReqFields, false); is causing... In the code you quoted, that line doesn't exist; this does: Event.observe('fm', 'submit', checkReqFields, false); I assumed at first that you were quoting the end result that went to the browser rather than the PHP source code, but then noticed that further down in the function you quoted, you _do_ have PHP source code, which made me wonder... Did you accidentally replace $formName with fm in your source, and are you now running with a different form name? Not likely, but just checking. If not that: You're sure that fm is the _ID_ of the form? E.g., form id='fm', not (for example) form name='fm'? If that's not it, to continue troubleshooting, I'd suggest picking up with #3 on this list:http://proto-scripty.wikidot.com/faq#xyzprob (BTW, if you're using 1.6, Event#observe no longer has the fourth parameter.) FWIW HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jan 21, 9:14 pm, n8cshaw n8cs...@gmail.com wrote: I am doing the following on one of my pages: document.observe(dom:loaded, function() { Event.observe('fm', 'submit', checkReqFields, false); $('resetBtn').observe('click',resetForm); #if(!$edit) initForm(); #else disableOther(); #end }); The line: Event.observe('$formName', 'submit', checkReqFields, false); is causing an element is null error on page load. If I remove that line, I don't get the error. The form that is referenced exists, the function checkReqFields exists and the script is located after the HTML, so all of the elements should exist before it is executed. I do something very similar on another page and it works fine. Any ideas as to what is causing this problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: help with autocompleter
yep, its not var as var, actually the name is different to var, i only use var as an example, alex can u help me with the autocompleter?, some ideas or one example, i was looking for a similar post with autocomplete function, but i dont understand to much, i need some for newies, thanks in advance On 22 ene, 01:26, Alex Mcauley webmas...@thecarmarketplace.com wrote: for a start i wouldnt use var as a var in this line var = transport.responseText; ... try var foo=transport.responseText; instead - Original Message - From: eulerss eulers...@hotmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Wednesday, January 21, 2009 6:31 PM Subject: [Proto-Scripty] help with autocompleter hi guys, i want to implement the autocomplete function with ajax, im very new using prototype (i only know how to do dependent selects), can you tell me some ideas? actually i have de database in mysql and i want to use php for this, thanks in advance for your help here is the simple code that i only know for selects: script type=text/javascript function OnChangeOrg() { some vars definitions ... var url = './file.php?var1=value1var2=value2, etc etc new Ajax.Request( url, { method: 'get', asynchronous: false, onSuccess: function(transport) { var = transport.responseText; } }); document.getElementById('id').innerHTML = 'select optionSelect/option' + var +'/select'; /script eulerss- Ocultar texto de la cita - - Mostrar texto de la cita - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Scriptaculous problem with option field
Ajax.Request and methods that inherit it(like autocompleter) accept JSON encoded objects as parameters (AFAIK) /* Set isMirror to something */ isMirror = myobj.isMirror(); /* OR if this is a server-side determined value echo it */ isMirror = ?php if(something){echo 'true';}else{echo 'false';} ?; /* Another example, get the value of some text node and pass it as a param */ myVal = $('textID').value; myParam:{action:'save',mirror:isMirror, value:myVal} //setup JSON encoded object /* ...Include it in your call to the server */ { parameters: myParam} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Scriptaculous problem with option field
myParam:{action:'save',mirror:isMirror, value:myVal} //setup JSON Sorry, should be: myParam = NOT myParam: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Scriptaculous problem with option field
You can only get value from a form element, not from a text node. If you want to read the raw text out of an HTML element, you'll need to use $('textID').innerHTML for that. Walter On Jan 22, 2009, at 11:34 AM, disccomp wrote: /* Another example, get the value of some text node and pass it as a param */ myVal = $('textID').value; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: What's crashing this page in IE6?
Try Downloading the IE 8 Beta and the Developer Tools, works much like Firebug in Firefox. It can catch javascript errors and let you step through the code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Having trouble with .without().
Hi. s_CSS = '.scrollBox label'; console.info($$(s_CSS)); console.info($$(s_CSS + '.nonSpacing')); console.info($$(s_CSS).without($$(s_CSS + '.nonSpacing'))); [label.nonSpacing, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.short, label, label, label] [label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.short] [label.nonSpacing, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.short, label, label, label] The first info shows me all the labels in the .scrollBox. The second info shows me all the labels in the scrollBox which are nonSpacing. The third info shows me the same as the first. The .without is NOT working as I would expect. Any ideas? Richard. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Event.observe: listen for form submit cancelled
Is there a way to listen for the user cancellation of a form submission. IE they press ESC or click 'Stop' in the browser after having initiated submission? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Having trouble with .without().
It appears as though without accepts its values in individual parameters. Looking at the documentation it does illustrate that each value is set in as its own parameter. http://prototypejs.org/api/array/without Looking into the source it becomes clear that it uses the function's arguments as array to purge values from, not the first argument as an array. A snippet from proto 1.6... without: function() { var values = $A(arguments); return this.select(function(value) { return !values.include(value); }); }, I'm pretty sure proto's CSS parser can handle the not pseudo selector, so you can do something like this... $$(s_CSS + :not(.nonSpacing)); http://www.w3.org/TR/css3-selectors/#negation -- http://positionabsolute.net On Jan 22, 12:27 pm, Richard Quadling rquadl...@googlemail.com wrote: Hi. s_CSS = '.scrollBox label'; console.info($$(s_CSS)); console.info($$(s_CSS + '.nonSpacing')); console.info($$(s_CSS).without($$(s_CSS + '.nonSpacing'))); [label.nonSpacing, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.short, label, label, label] [label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.short] [label.nonSpacing, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.short, label, label, label] The first info shows me all the labels in the .scrollBox. The second info shows me all the labels in the scrollBox which are nonSpacing. The third info shows me the same as the first. The .without is NOT working as I would expect. Any ideas? Richard. -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: help with autocompleter
please help, i was seeing one example but i have some doubts 1) in the principal file script src=lib/prototype.js type=text/javascript/script script src=src/scriptaculous.js type=text/javascript/script script src=src/unittest.js type=text/javascript/script its necessary to add the unittest.js?? (sorry i repeated, im noob in this) 2) if i used, for instance response.php in order to get all values, whats the correct form? i mean, can i used response.php simple like this ?php echo div ul liA/li liB/li ul /div; ? 3)whats the form when i'm calling the funcion ajax.autocompleter? script type=text/javascript language=javascript new Ajax.Autocompleter('id','id','response.php'); /script i'm correct? please tell me if i'm wrong in something, thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Having trouble with .without().
2009/1/22 Matt Foster mattfoste...@gmail.com: It appears as though without accepts its values in individual parameters. Looking at the documentation it does illustrate that each value is set in as its own parameter. http://prototypejs.org/api/array/without Looking into the source it becomes clear that it uses the function's arguments as array to purge values from, not the first argument as an array. A snippet from proto 1.6... without: function() { var values = $A(arguments); return this.select(function(value) { return !values.include(value); }); }, I'm pretty sure proto's CSS parser can handle the not pseudo selector, so you can do something like this... $$(s_CSS + :not(.nonSpacing)); http://www.w3.org/TR/css3-selectors/#negation I completely misread the Array.without(). I saw the individual elements and I must have had a brain fart. I'll try the negator. I did see it in the docs, but in the rush to get home, I think I've mistyped something. Thanks. Richard. On Jan 22, 12:27 pm, Richard Quadling rquadl...@googlemail.com wrote: Hi. s_CSS = '.scrollBox label'; console.info($$(s_CSS)); console.info($$(s_CSS + '.nonSpacing')); console.info($$(s_CSS).without($$(s_CSS + '.nonSpacing'))); [label.nonSpacing, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.short, label, label, label] [label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.nonSpacing, label.short] [label.nonSpacing, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.nonSpacing, label, label, label, label, label.short, label, label, label] The first info shows me all the labels in the .scrollBox. The second info shows me all the labels in the scrollBox which are nonSpacing. The third info shows me the same as the first. The .without is NOT working as I would expect. Any ideas? Richard. -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: order matters? cannot get handle to div (null)
True, but i was following some example in the book called Practical prototype and script.aculo.us (Dupont). I'll give both a go. On Jan 22, 4:46 pm, disccomp discc...@gmail.com wrote: Would it be easier to add something like: onClick=doSearch(); To: input type=submit name=btnSubmitSearch id=btnSubmitSearch value=Go!/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Having trouble with .without().
On Jan 22, 7:18 pm, Richard Quadling rquadl...@googlemail.com wrote: 2009/1/22 Matt Foster mattfoste...@gmail.com: [...] I completely misread the Array.without(). I saw the individual elements and I must have had a brain fart. You can, of course, always use `Function.prototype.apply` as a workaround : ) var set1 = [1,2,3,4]; var set2 = [1,3]; var subset = set1.without.apply(set1, set2); // etc. [...] -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Drag and drop inside a sortable triggers link.
I have been puzzling over this problem for a while. In short; if you have a a href inside the div - if you drag the div by anywhere that is affected by the a tag it will trigger the link when the mouse button is released. I think other people have been having this problem from a quick search of the forum, but few seem to have resolved it. Ive attempted to put some code that stops the click even - but it doesnt seem to work. The page is (originally) generated from a set of php scripts to pull the information from a database - and as you can see from the source im trying to do it in the most flexible way, with as little as possible hard coded. Here is the page: http://tinyurl.com/sortable here is my attempt at overriding the click: script type=text/javascript document.observe(dom:loaded, function() { $$('.lbOn').each(function(el) { var id = el.identify() new Sortable(id, { onStart: function() { Event.observe(id, 'click', stopClick); }, onEnd : function() { Event.stopObserving(id, 'click', stopClick); }, revert: true }); }); }); function stopClick(event) { Event.stop(event); } /script Many thanks for your brainwaves in advance. --Mat --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: What's crashing this page in IE6?
Im siding with freshteapot here, you've probably got an infinate loop. On Jan 20, 5:25 pm, Matt guitarroman...@gmail.com wrote: Hmm... that file's a Google file so there's nothing I can do with it, plus you'd expect it to be working... hmm. I monitored the CPU usage, it shoots to 100% right when it crashes. I guess it's all the JS, but there's plenty of other sites using heavy javascript... any ideas? Matt On Jan 20, 1:58 pm, freshteapot ch...@freshteapot.net wrote: Hello Matt, I went to the website and it only seems to be a javascript file to: script src=http://maps.google.com/intl/en_ALL/mapfiles/141e/ maps2.api/main.js type=text/javascript/script I would suggest running what tests you can on the individual scripts before starting to run tests which you can then combine with other libraries. Run it in firefox and see what errors it triggers as something which is causing IE to crash would probably give a little clue away at some point. Also, run IE with the taskmanager open and keep an eye on how much memory it starts to use. It could be an indication of a script caught in a loop. On Jan 20, 10:32 pm, Matt guitarroman...@gmail.com wrote: Hi there, I have a webpage demo up athttp://tinyurl.com/plstage(tinyURLso Google doesn't pick up the name...). We're using a lot of scripts: PTScripty, lightbox, a validation plugin and a slideshow script. I've tried removing these to test out why it would break the page in IE6, but short of removing them all at once, I can't seem to isolate the causes. Can anybody see anything on that page that could be causing IE to crash so catastrophically? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Change Event Not Firing On Text Field in IE
So, I have a simple bit of code that asks a user to confirm that they want to change the existing value of a text field: code ... Event.observe(this._form['txtFld'], 'change', this.txtFldChanged.bindAsEventListener(this), false); this._txtFld = this._form['txtFld'].value; ... function txtFldChanged(e) { var confirmed = (this._txtFld == ''); if (! confirmed) { confirmed = confirm('Are you sure you want to change the value of txtFld?'); } if (! confirmed) { this._form['txtFld'].value = this._txtFld; Event.element(e).focus(); } return confirmed; } /code In FF, this works fine, every time you edit the content of the field. In IE, it works once - after that the change event does not fire. I've seen some mention of a possible behavior issue in IE having to do with modification of the text field value programmatically within the event bubble for the field's change event, but nothing concrete. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---