[Proto-Scripty] Re: Weird Select list behavior in IE7

2010-08-17 Thread Nicholas
Hi all,

I have solved my issue by by using:

this.select.options[i] = new Option(opt.value, opt.key, null,
false);

rather than

this.select.insert({'bottom': new Element('option',
{'value':opt.key}).update(opt.value)});

Thanks to everyone who gave this some thought!

(Sorry for the top post)

-- Nich

On Aug 17, 10:26 am, Nich nicholas.stei...@narthollis.net wrote:
 Hi all,

 I have a site that i need to make work in IE7 but i have run into a
 very frustrating issue.

 I am using django to generate the form for a payment request. As a
 part of this form the user can input one or more breakdowns for this
 payment, Because I only want to write the form once I duplicate the
 breakdown using element.clone() and then clean it up before creating a
 new form. I have this all working quite nicely. The issue I'm having
 is when I combine this behavior with some code I have to allow the
 filtering of select lists.

 The issue occurs in IE7 and IE8 when rendering as IE7. It does not
 occur in any other browser I have tested.

 Here is an example:

 http://www.lccare.org.au/~nsteicke/selectissue/

 To replicate, use IE7 or IE8 in IE7 compatibly mode, then click '+ Add
 Breakdown' and then filter the new select list and try and expand the
 list.

 Any assistance you can offer in solving this issue would be great.

 -- Nich

-- 
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-scriptacul...@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: Ajax.request with enctype:multipart/form-data

2010-06-10 Thread Gregory Nicholas
I had an AJAX file upload solution built out, where you use javascript
to create a hidden iframe element, then you set the form to post to
that hidden frame. It worked, however if you go through the trouble of
that i would recommend you opt for a flash based file uploader. Much
more robust and can give you a multiple file upload functionality.



On Jun 4, 2:46 am, Peter De Berdt peter.de.be...@pandora.be wrote:
 On 04 Jun 2010, at 00:57, jon...@gmail.com wrote:

  I want to send a form with the enctype as multipart/form-data
  using the prototype ajax.request
  how can I do it?

 If you want file upload using Ajax, google for AJAX file upload. You  
 basically can't do it due to Javascript security and have to rely on  
 either an iFrame to post the form data to or a Flash-based solution.  
 You could also wait a couple more years until the HTML5 File API is  
 implemented across all browsers :-)

 Best regards

 Peter De Berdt

-- 
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-scriptacul...@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: Setting the focus on an input after an effect to show the input.

2010-06-10 Thread Gregory Nicholas
it should be as follows:

new Effect.Parallel([
new Effect.Appear('banner',  {duration : 1.00, delay :
0.50}),
new Effect.Appear('vsContainer', {duration : 2.00, delay :
0.50})
],
{
sync: true,
afterFinish: function() {
$('requestVehicle').focus();
}
}
);

-- 
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-scriptacul...@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: storying and destroying metadata

2010-05-23 Thread Gregory Nicholas
what version of prototype are you using? i cant find it in the docs



On May 21, 12:06 am, orbiter dkarapet...@gmail.com wrote:
 I recently discovered Element.store and Element.retrieve and I'm
 wondering a little about the semantics. Mainly I'm interested in the
 following use case: If I store some data and then delete the object on
 which I stored the data from the DOM tree what happens to the stored
 data? Do I need to worry about explicitly cleaning up everything I've
 stored before deleting the object or is that taken care of
 automatically?

 --
 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-scriptacul...@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-scriptacul...@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] Proper observer removal

2010-04-12 Thread Gregory Nicholas
If i setup an html link element to be observed, and then i
subsequently remove the html element without calling stopObserving(),
does that remove the observer? or does it create a leak of some sort?

Ex:

$('logo').observe('click', function (e) {
 e.stop();
});
// remove the html element w/o stopObserving
$('logo').remove ();

-- 
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-scriptacul...@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: Optimize table content filtering.

2010-04-08 Thread Gregory Nicholas
I used the Scriptaculous autocompleter with a set of custom extend
functions to filter table rows, tr tags, by a class name with some
custom attributes. There is quite a bit of code below, so contact me
if you need a more detailed walk-through. I can be reached in
evenings, by usually calling your mother, who i may or may not have
been banging. I love her stories.. or, probably more often by Gchat!!

Javascript looks like this:

Searcher = {
selector : function ( instance ) {
try {
var ret = [];
var partial = [];
var entry = instance.getToken ();
var count = 0;
for (var i = 0; i  instance.options.array.length  
ret.length
 instance.options.choices; i++) {
var itemLabel = instance.options.array [ i ].label;
var itemValue = instance.options.array [ i ].val;
var itemId = instance.options.array [ i ].itemId;
var foundPos = instance.options.ignoreCase ?

itemLabel.toLowerCase().indexOf(entry.toLowerCase()) :
itemLabel.indexOf(entry);
while (foundPos != -1) {
if (foundPos == 0  itemLabel.length != 
entry.length) {
var li = 'li item-id=' + itemId + 
' item-value=' +
itemValue + '';
li += 'strong' + 
itemLabel.substr(0, entry.length) + '/
strong';
li += 
itemLabel.substr(entry.length);
li += '/li';
ret.push(li);
break;
} else if (entry.length = 
instance.options.partialChars 
instance.options.partialSearch  foundPos != -1) {
if (instance.options.fullSearch || /
\s/.test(itemLabel.substr(foundPos-1,1))) {
var li = 'li item-id=' + 
itemId + ' item-value=' +
itemValue + '';
li += itemLabel.substr(0, 
foundPos) + 'strong' +
itemLabel.substr(foundPos, entry.length) + '/strong' +
itemLabel.substr( foundPos + entry.length);
li += '/li';
partial.push(li);
break;
}
}
foundPos = instance.options.ignoreCase ?

itemLabel.toLowerCase().indexOf(entry.toLowerCase(), foundPos
+ 1) :
itemLabel.indexOf(entry, foundPos + 1);
}
}
if ( partial.length ) {
ret = ret.concat ( partial.slice ( 0, 
instance.options.choices
- ret.length ) );
} else {
Searcher.hideItems ( '' );
}
if ( ret.length == 0 ) {
Searcher.hideItems ( '' );
}
return ul + ret.join ( '' ) + /ul;
} catch ( e ) { alert ( e ); }
},
render: function () {
try {
if ( this.entryCount  0 ) {
for ( var i = 0; i  this.entryCount; i++ ) {
this.index == i ? Element.addClassName ( 
this.getEntry ( i ),
'selected' ) : Element.removeClassName ( this.getEntry ( i ),
'selected' );
}
if( this.hasFocus ) {
this.show ();
this.active = true;
Searcher.showList ( this );
}
} else {
this.active = false;
this.hide ( '' );
Searcher.hideItems ( '' );
}
} catch ( e ) { alert ( 'Error in render: ' + e ); }
},
showList : function ( instance ) {
try {
Searcher.hideItems ( '.open' );
var listItems = $$ ( '#item-searcher-list li' );
listItems.each ( function ( listItem ) {
var variationId = listItem.readAttribute ( 
'item-value' );
listItem.addClassName('open');
listItem.show ();
$ ( 'list-item-' + variationId ).show ();
});
} 

[Proto-Scripty] Effect.Highlight Breaks CSS Hover

2009-07-17 Thread Nicholas Van Weerdenburg
Hi,
I found this ticket
http://dev.rubyonrails.org/ticket/6134

but the problem still exists.  No matter what I do, Effect.Highlight
pollutes the DOM by changing the element background color, breaking css
:hover and other style rules due to the element rule css precedence

Anyone know of a workaround? I tried :restorecolor= but that doesn't
work. Calls to set the background color to  fail, I think due to the
timing of the hightlight.

Thanks,
Nick

--~--~-~--~~~---~--~~
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: Effect.Highlight Breaks CSS Hover

2009-07-17 Thread Nicholas Van Weerdenburg
Thanks!

On Fri, Jul 17, 2009 at 10:42 AM, T.J. Crowder t...@crowdersoftware.comwrote:


 Hi,

 Yeah, bit of a pain that there's no standard way to _remove_ a style
 from the style property entirely.  Setting things to  is not the
 same thing.

 However:  Effects offer beforeStart and afterFinish callbacks, and the
 style property has this nifty cssText property on it, which suggests
 this should work around the problem (and may be a way forward for an
 eventual scripty fix):

$('target').highlight({
beforeStart: function(effect) {
effect.saveStyle = effect.element.style.cssText;
},
afterFinish: function(effect) {
effect.element.style.cssText = effect.saveStyle;
}
});

 cssText is fairly widely supported, I believe, even IE6 had it (not
 that :hover works with IE6, except on links).  In fact, Prototype's
 setStyle uses it if you pass in a string (an undocumented feature;
 docs say it has to be an object, so it may not get unit tested).

 HTH,

 On Jul 17, 2:33 pm, Nicholas Van Weerdenburg vanwe...@gmail.com
 wrote:
  Hi,
  I found this tickethttp://dev.rubyonrails.org/ticket/6134
 
  but the problem still exists.  No matter what I do, Effect.Highlight
  pollutes the DOM by changing the element background color, breaking css
  :hover and other style rules due to the element rule css precedence
 
  Anyone know of a workaround? I tried :restorecolor= but that doesn't
  work. Calls to set the background color to  fail, I think due to the
  timing of the hightlight.
 
  Thanks,
  Nick
 


--~--~-~--~~~---~--~~
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: Get an array from PHP via Ajax.Request

2009-04-29 Thread Nicholas Steicke

Russell Keith wrote snip:

 When doing calling Ajax.Request is there a way to take an array
 returned by PHP and read it into a JavaScript array?  Or would I need
 to split the array in PHP to a comma separated string then read it
 back into an array in JavaScript?



Try taking a look at JSON.

http://php.net/manual/en/book.json.php


Kind regards,
Nich


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---