Re: [Proto-Scripty] element is null - say what
Does your field have the ID attribute set to 'zip'? If it's working in IE, that's a strong bet that it doesn't, but that it does have the name set to 'zip'. Element.getValue() and $F() need a valid (properly- formed and unique on the page) ID for their magic to happen. If you can't add an ID to the input, you can pass a more elaborate selector like document.forms[0].zip (without surrounding quotes, naturally) into the function. $() will work from an object or an ID, but it won't work with just a name, except in IE, which has a serious bug in that corner. Walter On Jun 13, 2011, at 11:03 AM, Phil Petree wrote: In Firefox 3.6.16 I have an Event.observe('ajzip', 'keyup', cities); and the first line of which tests to see if I have 5 digits entered in the zip code field and if so it makes an ajax call... works great in IE. When I press and release a key, my function cities gets called, it tests the length of zip and then jumps into prototype.js on line 4064 where it attempts to execute the following lines: 1) getValue: function(element) { 2) element = $(element); 3) var method = element.tagName.toLowerCase(); 4) return Form.Element.Serializers[method](element); When line 1 gets called, element is set to zip; line 2 returns null and line 3 throws an Element is null error! Like I said, this all works fine in IE. Any ideas? -- 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 . -- 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.
Re: [Proto-Scripty] element is null - say what
Can I also assume that you have either wrapped your listener function in a dom:loaded listener, or have placed it inside a script block BELOW the ajzip element? That's another reason why it might not work in some cases, although I would be surprised if it worked in any browser if the listener was defined in the DOM before the element it was supposed to listen to. http://jsbin.com/odusi5/3 Walter On Jun 13, 2011, at 11:35 AM, Phil Petree wrote: Walter you made me doubt myself... LOL I've been integrating this new code with the old form and the id's are different in the old form but I had made those changes. Event.observe('ajzip', 'keyup', cities); label class='column' id='labzip' for='ajzip'5 Digit Zip:/ labelinput type='text' name='zip' size='5' maxlength='5' id='ajzip' class='required validate-digits' On Mon, Jun 13, 2011 at 11:12 AM, Walter Davis wa...@wdstudio.com wrote: Does your field have the ID attribute set to 'zip'? If it's working in IE, that's a strong bet that it doesn't, but that it does have the name set to 'zip'. Element.getValue() and $F() need a valid (properly-formed and unique on the page) ID for their magic to happen. If you can't add an ID to the input, you can pass a more elaborate selector like document.forms[0].zip (without surrounding quotes, naturally) into the function. $() will work from an object or an ID, but it won't work with just a name, except in IE, which has a serious bug in that corner. Walter On Jun 13, 2011, at 11:03 AM, Phil Petree wrote: In Firefox 3.6.16 I have an Event.observe('ajzip', 'keyup', cities); and the first line of which tests to see if I have 5 digits entered in the zip code field and if so it makes an ajax call... works great in IE. When I press and release a key, my function cities gets called, it tests the length of zip and then jumps into prototype.js on line 4064 where it attempts to execute the following lines: 1) getValue: function(element) { 2) element = $(element); 3) var method = element.tagName.toLowerCase(); 4) return Form.Element.Serializers[method](element); When line 1 gets called, element is set to zip; line 2 returns null and line 3 throws an Element is null error! Like I said, this all works fine in IE. Any ideas? -- 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 . -- 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 . -- 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 . -- 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.
Re: [Proto-Scripty] how-to add option to select
JSbin is a popular way to show working examples. Gives you a persistent URL and you can edit it and demo it right in the browser. Walter On Jun 8, 2011, at 3:19 PM, Phil Petree wrote: Where are ya'll posting the demo 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.
Re: [Proto-Scripty] how-to add option to select
That's true, that's generally not available as far as I know. That's why you put up a scratch server somewhere, and then you can upload and test whatever you want. But JSbin is excellent for making stand-alone test pages, since you are forced to put everything in one page, and you tend to simplify to the point where you smack your forehead and say never mind to the mailing list. Walter On Jun 8, 2011, at 3:49 PM, Phil Petree wrote: I looked at jsbin earlier and have actually tested some snippets there... however you can't (to my knowledge) upload your php code there. I wanted to stick all the source modules up. On Wed, Jun 8, 2011 at 3:28 PM, Walter Davis wa...@wdstudio.com wrote: JSbin is a popular way to show working examples. Gives you a persistent URL and you can edit it and demo it right in the browser. Walter On Jun 8, 2011, at 3:19 PM, Phil Petree wrote: Where are ya'll posting the demo 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 . -- 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 . -- 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.
Re: [Proto-Scripty] how-to add option to select
Your function is using add() to add an option to the end of the select, but I have never seen that work completely myself. Best to stick with the long-hand methods, they are at least known to work in most browsers: menu = $('mySelectList'); menu.options[menu.options.length] = new Option('Label','value'); Walter On Jun 7, 2011, at 4:09 PM, Phil Petree wrote: I've tried every option that I can find or figure out to add an option to a select using prototype or dom. What I have figured out is that when prototype 1.6.x is present normal dom functions dont SEEM work! ??? So how do you add an option to a select in prototype? ??? I have: var value = New York; // json.options[i].value var display = New York; // json.options[i].text I have tried: $('city').options[i] = new Option(json.options[i].text, json.options[i].value, null,(selsel==json.options[i].value? true:false)); $('city').add = new Option(display, value); addOption('city', value, display); addOption('city', New York, New York); select.insert(new Element('option', {value: value}).update('city')); // and about a dozen other options // this function works if called from the form with onclick=addOption('city', 'New York', 'New York') // but if called from the onSuccess function and being passed the data (or even hard coded) I get nothing! function addOption(selectID, value, display) { var myselect = document.getElementById(selectID); try { myselect.add(new Option(display, value), null); //add new option to end of selectID } catch(e) { //in IE, try the below version instead of add() myselect.add(new Option(display, value)); //add new option to end of selectID } } -- 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 . -- 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.
Re: [Proto-Scripty] how-to add option to select
Try doing this inside an Ajax.Request, not an Updater. You can still update things, but you do it yourself, and I think you might not get these problems. My guess is that you are trying to update a picker that has been swapped out beneath you. If it works in a click, it will work in an Ajax.Request callback. Walter On Jun 7, 2011, at 5:23 PM, Phil Petree wrote: thanks Walter... bottom line is that addOption works fine if called directly but only clears the select if called from the Ajax.updater onSuccess... even using static data! This works: select id='county' name='county' onclick=addOption('city', 'New Boca','New Boca')/selectbr/ This doesn't (button is clicked (onclick=cities()): function cities() { if($F('zip').length == 5) { var options = { method: 'get', parameters: 'zip='+escape($F('zip')), onSuccess: city_fill, onFailure: ajax_fail, on0: ajax_fail}; var myAjax = new Ajax.Updater('city', 'cities.php', options); } } function city_fill(transport, json) { var szSelectID = 'city'; var json = transport.responseText.evalJSON(true); // length = 7 for the zip I am testing with for( var i=0; ijson.options.length; i++) { var szValue = json.options[i].value; var szDisplay = json.options[i].text; addOption('city', 'New York', 'New York'); } } On Tue, Jun 7, 2011 at 5:08 PM, Walter Davis wa...@wdstudio.com wrote: Your function is using add() to add an option to the end of the select, but I have never seen that work completely myself. Best to stick with the long-hand methods, they are at least known to work in most browsers: menu = $('mySelectList'); menu.options[menu.options.length] = new Option('Label','value'); Walter On Jun 7, 2011, at 4:09 PM, Phil Petree wrote: I've tried every option that I can find or figure out to add an option to a select using prototype or dom. What I have figured out is that when prototype 1.6.x is present normal dom functions dont SEEM work! ??? So how do you add an option to a select in prototype? ??? I have: var value = New York; // json.options[i].value var display = New York; // json.options[i].text I have tried: $('city').options[i] = new Option(json.options[i].text, json.options[i].value, null,(selsel==json.options[i].value? true:false)); $('city').add = new Option(display, value); addOption('city', value, display); addOption('city', New York, New York); select.insert(new Element('option', {value: value}).update('city')); // and about a dozen other options // this function works if called from the form with onclick=addOption('city', 'New York', 'New York') // but if called from the onSuccess function and being passed the data (or even hard coded) I get nothing! function addOption(selectID, value, display) { var myselect = document.getElementById(selectID); try { myselect.add(new Option(display, value), null); //add new option to end of selectID } catch(e) { //in IE, try the below version instead of add() myselect.add(new Option(display, value)); //add new option to end of selectID } } -- 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 . -- 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 . -- 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 . -- 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.
Re: [Proto-Scripty] how-to add option to select
On Jun 7, 2011, at 9:00 PM, Phil Petree wrote: Matt Walter, You are both right... Ajax.Updater is, apparently, trying to update the select AFTER it calls onSuccess and since it is incapable of updating a select it was thereby overwritting my adds... no problem, once I figured that out, I just added in a div id='results' and let the updater put the json there... it makes it easy to debug and I can update it once I get this fully working (or leave it in the example I plan on posting somewhere so the next person doesn't have to go through all this). Next two things are: 1) clear the selects. $('city').clear() doesnt work nor does $ ('city).options.length = 0; Any suggestions on how to go about that? I always set theSelect.options.length = 0 and that works for me. Can you post a self-contained failing example so I can try it? 2) get the event observers to work... neither $ ('zip').observe('onkeyup', cities); OR Event.Observe('zip', 'onkeyup', counties); works In Event.Observe or the Element.observe convenience method, you drop the on part of the event name. So you would put $ ('zip').observe('keyup',doSomethingWild); Glad you're back on track! Walter On Tue, Jun 7, 2011 at 5:41 PM, Matt Petrovic cyberbr...@gmail.com wrote: try using Ajax.Request -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/QTllMU5xRkRZMllK . 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 . -- 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 . -- 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.
Re: [Proto-Scripty] Re: A bit of assistance please
On Jun 3, 2011, at 11:21 AM, Eric wrote: On Jun 1, 4:33 pm, Walter Davis wa...@wdstudio.com wrote: On Jun 1, 2011, at 10:19 AM, Eric wrote: On May 31, 5:51 pm, Walter Davis wa...@wdstudio.com wrote: On May 31, 2011, at 11:12 AM, bill wrote: I need the scroll of the div contents only. You can back into that by using the cumulative offset, and subtracting the document.viewport.getScrollOffsets() from that. Or you may use yourdiv.scrollTop and yourdiv.scrollLeft Eric I knew there was something simpler! Is that completely cross- platform? I ask because I suspect it's native, and therefore not in the Prototype Element namespace. Does that mean that it's safe to use in all browser/OS combos? Not sure about the all browser/OS combo, but it works on Windows on IE6+ and FF2+ (and possibly on older versions). I would be interested to know if it works on Safari/Chrome and on OSX/ Linux. Anyone who has a moment, please test this out here: http://scripty.walterdavisstudio.com/scroll-offsets.html All the script is inline for ease of criticism! Walter Eric Walter -- 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 . -- 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.
Re: [Proto-Scripty] Re: A bit of assistance please
On May 31, 2011, at 10:57 AM, bill wrote: On 5/30/2011 11:22 AM, Eric wrote: Hi Bill, Using Event.PointerX() and Event.PointerY() you can get the absolute position of the mouse on the page. Using Element.Layout you can get the exact position of your image. If you substract the layout's left value to PointerX and the layout's top value to PointerY, you should have the X/Y position relative to top/left corner of your image. More simple but I am not sure it is crossbrowser supported, events *may* have clientX and clientY attributes which *may* contain what you're looking at (if your event is attached to the img DOM object). Take a look at Element.cumulativeScrollOffset and see if that can give you what you need. According to the docs, it can handle multiply- nested scrolling containers. Walter I can use clientX/Y or pageX/Y to get the location of the mouse, but I can't figure out how to get the scroll of the _DIV_. I looked at the options available for Element, but which will give me the amount that the contents of the _DIV_ have scrolled. pageX/Y gives me the amount the body is scrolled, not the _DIV_. -- Bill Drescher william {at} TechServSys {dot} com -- 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 . -- 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.
Re: [Proto-Scripty] Re: A bit of assistance please
On May 31, 2011, at 11:12 AM, bill wrote: On 5/31/2011 11:06 AM, Walter Davis wrote: On May 31, 2011, at 10:57 AM, bill wrote: On 5/30/2011 11:22 AM, Eric wrote: Hi Bill, Using Event.PointerX() and Event.PointerY() you can get the absolute position of the mouse on the page. Using Element.Layout you can get the exact position of your image. If you substract the layout's left value to PointerX and the layout's top value to PointerY, you should have the X/Y position relative to top/left corner of your image. More simple but I am not sure it is crossbrowser supported, events *may* have clientX and clientY attributes which *may* contain what you're looking at (if your event is attached to the img DOM object). Take a look at Element.cumulativeScrollOffset and see if that can give you what you need. According to the docs, it can handle multiply-nested scrolling containers. Walter I looked at that, but I do not want to account for the scroll of the body, and cumulativeScrollOffset seems as it would do that. I need the scroll of the div contents only. You can back into that by using the cumulative offset, and subtracting the document.viewport.getScrollOffsets() from that. Walter Thanks for the thought bill I can use clientX/Y or pageX/Y to get the location of the mouse, but I can't figure out how to get the scroll of the _DIV_. I looked at the options available for Element, but which will give me the amount that the contents of the _DIV_ have scrolled. pageX/Y gives me the amount the body is scrolled, not the _DIV_. -- Bill Drescher william {at} TechServSys {dot} com -- 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 . -- Bill Drescher william {at} TechServSys {dot} com -- 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 . -- 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.
Re: [Proto-Scripty] Strange behaviour of innerHTML
Maybe those browsers don't expose getters and setters as if they were attributes. What you're coding in your new Element call is equivalent to this: div innerHTML=hello/div IE has lots of bugs around attributes and methods clashing. Try naming a submit button submit some time and see how much fun you can have. var text1 = new Element('div').update('hello'); //? var text1 = newElement('div').innerHTML = 'hello'; //? see if one of those does the quicker job for you. I believe that this is the fastest of all, but it doesn't return you a reference to the element you just created: $('someParentElement').insert('divhello/div'); Maybe you could add an ID or className to the div you create that way, and then test for it later when you need a reference to the element. Walter On May 13, 2011, at 9:41 AM, jose maria Cano wrote: Hi Guys, I've discovered a way to create and insert an element in a faster way, for IE the difference is huge, like a half better. Normally I’m creating the elements in this way. var text1 = new Element('div').insert('hello'); But I’ve seen that if you do that, is much faster: var text1 = new Element('div', { 'innerHTML': 'hello' }); The problem is that this second way is only working for IE, not for FF or Chrome. Do you know what’s the problem? Thanks a lot in advanced. Kr, Jose -- 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 . -- 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.
Re: [Proto-Scripty] Text selections
Selecting all text in a textarea is as simple as $ ('theIdOfTheBox').select(); I have written an example that works with any text on the page, inspired by the New York Times' definition widget. http://scripty.walterdavisstudio.com/lookup Walter On May 9, 2011, at 10:33 PM, kstubs wrote: Can anyone recommend code or library that helps with making text selections? For example, selecting all text in a texarea? Does Prototype help with this at all? Karl.. -- 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 . -- 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.
Re: [Proto-Scripty] IE Sortable issue
For example, here is a Self-contained Non-failing Test: http://scripty.walterdavisstudio.com/drag-sort.html Please try this out in your failing browsers, and let me know if you are able to drag the first or last element in the list to a new position. The sort order will update below the list each time you re- order the list. Walter On May 2, 2011, at 5:06 PM, Walter Davis wrote: This is where the Self Contained Failing Test is useful. Try to make a static HTML version of your assembled page at the point where it fails. Use Firebug's inspector to see the rendered HTML including any client-side modifications and use copy and paste liberally to construct this Frankenpage in a text editor. Then confirm that it still fails for you, and if it does, post it somewhere where another pair of eyes can look at it. (Post a link here.) Walter On May 2, 2011, at 2:55 PM, Audrey Bowman wrote: I have been going through the page element by element to make sure it all validates (it includes different files based on forms being submitted). Still going through some of it, but everything so far has been fixed to validate. I rigged it so that it was only processing what had validated, and I am still unable to drag any elements down. Still works going up, though. On Mon, May 2, 2011 at 1:49 PM, Walter Davis wa...@wdstudio.com wrote: Make sure that your page is valid before anything else. If a script works in one browser/version and not others, that's a strong hint that the HTML is being interpreted in more than one manner. Valid HTML or XHTML is unambiguous. Walter On May 2, 2011, at 1:43 PM, Audrey Bowman wrote: Hi Walter, I've got it to work in IE8 now - closing out a form and starting a new one did it. And it sort of works in IE 7 now. I can drag objects up, but cannot drag elements below any of the lower elements. I'm sorting database results, identified by DIVS. Basically it's a multi-line formatted result set that I want users to be able to re- sort as necessary. Thanks for your help, Audrey On Mon, May 2, 2011 at 1:28 PM, Walter Davis wa...@wdstudio.com wrote: What is the HTML structure that you are sorting? Is it an UL with sortable LIs, or another structure? Walter On May 2, 2011, at 11:11 AM, Audrey wrote: I have a problem with the sortable function in IE (I've tested both 7 8). It does not occur in Firefox or Chrome. What is happening is that if a user tries to change the first element of my sortable list, it does the following: In IE7, it will not allow the user to change the position of the top element. It is draggable, but will not move the other elements. It simply adds a blank space at the top of the element list. Dragging elements other than the first works just fine. -- 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 . -- 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 . -- 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 . -- 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 . -- 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 . -- 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
Re: [Proto-Scripty] IE Sortable issue
What is the HTML structure that you are sorting? Is it an UL with sortable LIs, or another structure? Walter On May 2, 2011, at 11:11 AM, Audrey wrote: I have a problem with the sortable function in IE (I've tested both 7 8). It does not occur in Firefox or Chrome. What is happening is that if a user tries to change the first element of my sortable list, it does the following: In IE7, it will not allow the user to change the position of the top element. It is draggable, but will not move the other elements. It simply adds a blank space at the top of the element list. Dragging elements other than the first works just fine. -- 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.
Re: [Proto-Scripty] IE Sortable issue
Make sure that your page is valid before anything else. If a script works in one browser/version and not others, that's a strong hint that the HTML is being interpreted in more than one manner. Valid HTML or XHTML is unambiguous. Walter On May 2, 2011, at 1:43 PM, Audrey Bowman wrote: Hi Walter, I've got it to work in IE8 now - closing out a form and starting a new one did it. And it sort of works in IE 7 now. I can drag objects up, but cannot drag elements below any of the lower elements. I'm sorting database results, identified by DIVS. Basically it's a multi-line formatted result set that I want users to be able to re- sort as necessary. Thanks for your help, Audrey On Mon, May 2, 2011 at 1:28 PM, Walter Davis wa...@wdstudio.com wrote: What is the HTML structure that you are sorting? Is it an UL with sortable LIs, or another structure? Walter On May 2, 2011, at 11:11 AM, Audrey wrote: I have a problem with the sortable function in IE (I've tested both 7 8). It does not occur in Firefox or Chrome. What is happening is that if a user tries to change the first element of my sortable list, it does the following: In IE7, it will not allow the user to change the position of the top element. It is draggable, but will not move the other elements. It simply adds a blank space at the top of the element list. Dragging elements other than the first works just fine. -- 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 . -- 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 . -- 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.
Re: [Proto-Scripty] Re: FInd and iterate over ProcessingInstruction nodes?
That's a very cool idea, certainly do-able with about 2 lines of Ruby code in my pre-processor! Thanks for the suggestion. Walter On Apr 28, 2011, at 5:15 AM, T.J. Crowder wrote: Walter, Unfortunately, I think you're out of luck, because I don't think browsers retain processing instructions in the DOM. (Obviously if you were dealing with the original XML, that would be different.) At least, when I tried it, Firefox just completely dropped them and Chrome converted them into comments (and sadly, the Comment node type doesn't have any properties, so you can't get at them that way). Which is too bad, because even without Prototype supporting them, it's not hard to create a DOM walker that would have found them if they were there: * * * * function walk(instructions, node) { var child; switch (node.nodeType) { case Node.PROCESSING_INSTRUCTION_NODE: instructions.push(node.data); break; case Node.ELEMENT_NODE: for (child = node.firstChild; child; child = child.nextSibling) { walk(instructions, child); } break; } return instructions; } var instructions = walk([], document.documentElement); * * * * But again, that doesn't work, because the nodes just aren't there as far as I can tell. There is an element that you can include /nearly/ anywhere, though: `script`. And in fact, the HTML5 specification even says[1] that `script` ... allows authors to include dynamic script AND DATA blocks in their documents. (My emphasis.) So you might have your pre-processor convert them into `script` elements, perhaps of type x-application/procinst, e.g.: body ?pb Edition: current; Page: xxiii? h1Now This Is Interesting/h1 pInteresting stuff here/p ?pb Edition: current; Page: xxiv? h1Even More Interesting/h1 becomes body script type='x-application/procinst'pb Edition: current; Page: xxiii/script h1Now This Is Interesting/h1 pInteresting stuff here/p script type='x-application/procinst'pb Edition: current; Page: xxiv/script h1Even More Interesting/h1 A quick test (http://jsbin.com/ijolu3) indicates that even IE6 knows to leave `script` contents of an unknown type alone. I tried that on current versions of Chrome, Firefox, and Safari, as well as IE6, IE7, and IE9. It isn't, strictly speaking *valid* because (for instance) you can't have a `script` element that's an immediate child of a `ul`. But firstly, that seems like an error in the spec (why not?), and secondly, the browsers don't seem to mind. [1] http://www.w3.org/TR/html5/scripting-1.html#script FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Apr 28, 3:26 am, Walter Davis wa...@wdstudio.com wrote: That would work if I was grepping through the source, but I'm trying to pick this thing out of the DOM so I can hook onto it and add a visible element near it. I can't seem to find a way to access it there. Thanks for the suggestion, though. Walter On Apr 27, 2011, at 8:32 PM, kstubs wrote: Probably your best best is REGEX result = subject.match(/\?[a-zA-Z0-9 :;]*\?/img); result is an array of matches. So, result[0], result[1], and so on... -- 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 athttp://groups.google.com/group/prototype-scriptaculous?hl=en . -- 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 . -- 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.
Re: [Proto-Scripty] Re: FInd and iterate over ProcessingInstruction nodes?
Aha, I just read further, and it appears this won't work for what I'm doing, which is in part creating a valid XHTML branch to build epub documents, PrinceXML PDF documents, etc. from. I could certainly strip these out when building those iterations, but I guess I'll keep looking and see if I can figure out another way to go. Walter On Apr 28, 2011, at 5:15 AM, T.J. Crowder wrote: It isn't, strictly speaking *valid* because (for instance) you can't have a `script` element that's an immediate child of a `ul`. But firstly, that seems like an error in the spec (why not?), and secondly, the browsers don't seem to mind. -- 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.
Re: [Proto-Scripty] Template to element
You can insert it, and it will be instantiated into the element you desire, assuming that it is valid HTML after it's been evaluated, and you're inserting it into a spot in the DOM where that makes sense. For example, a TR inside a TBODY or THEAD, a SPAN inside a P... If you want to make an Element and do things with it either before or without inserting it into the visible page, you can use the new Element(tag,{attributes}) syntax to do that. Added benefit that you have a full element, you can attach listeners to it, etc, without needing to insert it in the page or make it visible. Walter On Apr 28, 2011, at 7:42 PM, kstubs wrote: Template evaluate returns a string. What is the best way to go from string to Element? -- 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 . -- 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.
Re: [Proto-Scripty] Re: FInd and iterate over ProcessingInstruction nodes?
That would work if I was grepping through the source, but I'm trying to pick this thing out of the DOM so I can hook onto it and add a visible element near it. I can't seem to find a way to access it there. Thanks for the suggestion, though. Walter On Apr 27, 2011, at 8:32 PM, kstubs wrote: Probably your best best is REGEX result = subject.match(/\?[a-zA-Z0-9 :;]*\?/img); result is an array of matches. So, result[0], result[1], and so on... -- 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 . -- 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.