[Proto-Scripty] Prototype in Firefox 17

2012-12-04 Thread Eric Kanagy
We're having issues with the newly released Firefox 17.0.1. Weird syntax 
error in places that don't make any sense (like line 642 of prototype.js): 

return 
 this.stripTags().replace(/lt;/g,'').replace(/gt;/g,'').replace(/amp;/g,'');


I read 
herehttps://forums.mozilla.org/addons/viewtopic.php?p=25091sid=3562c3c178aad8675ca759e238a478fathat
 Firefox 17 no longer supports the toString function as before:

 `toString` for function objects has changed.
 Error: The `toString` implementation for function objects have changed. If 
 you are using `eval` or `Function` to change the behavior of 'native' 
 functions, it is probably not working correctly in Firefox 17 and above.


Anyone else having this issue? What's the fix?

-- 
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/-/QxrMZzJmAiMJ.
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] Got CSRF issue when use Ajax.Updater in Django

2012-11-16 Thread Eric Yi
Hi,

I use Django framework to set up my webserver and try to use protype 1.7 .
When I call Ajax.Updater function to asynchronous reflash my page , I got 
Forbidden 403 error: CSRF verification failed. Request aborted.
Anyone can help me on this?

Thanks

-- 
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/-/_o6tk1UMucQJ.
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] anyone experiencing issues in IE10

2012-10-10 Thread Eric Maurer
I have a site with a considerable amount of work done and in IE 10... 
the code is not working. Anyone experience issues with IE10?
The site is www.toddscycle.com and the section is Motorcycles if anyone 
wants to see examples.
Any help would be greatly appreciated. 

-- 
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/-/iDL41RGMOTQJ.
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: IE8 + Prototype AJAX = HTTP Status 12019

2011-12-19 Thread Eric
Hi,

Is your application running on some kind of intranet network?

This seems close to an issue we got with IE9 and I wouldn't be
surprised if the issue was already present on IE8.
Basically, (and for some reason only known from MS), when on a
Trusted Site IE9 revert to compatibility mode, which from what we've
seen is mostly IE6 mode.
If your issue is an IE6 bug, that would explain why it is back on
IE8.
Sadly, there is no way to force IE9 to use its native (more) W3C
compliant from the server (if somebody knows a way, please post
it :o) ) but it is possible using menu options to change this.

Have a look here: 
http://blogs.msdn.com/b/ie/archive/2009/06/17/compatibility-view-and-smart-defaults.aspx

Eric

On Dec 16, 11:47 am, Phil Petree phil.pet...@gmail.com wrote:
 Unless you're getting paid by the hour, you loose nothing by temporarily
 trying a later version of prototype.  Try eliminating the easy stuff before
 working on the hard and you'll avoid that headslap moment that comes when
 you realize you wasted two weeks for nothing.
 On Dec 15, 2011 3:35 PM, web_dev_ajax lily.o...@gmail.com wrote:







  Thanks for the suggestion. That's an option that we plan to do with
  the next Production release. Unfortunately, we have release cycles
  that we have to adhere to and in the mean time, the client is unhappy
  with getting these 12XXX status code errors. I have also done a diff
  between version 1.4.0 and 1.7.0 and I don't see any differences that I
  believe may help with these 12XXX status errors, but we won't know
  until we do a release and see if the errors are still occurring.

  I do have an update - it seems that ALL the users at the client shop
  are now getting the 12XXX status code errors on IE8 (12019 and 12152
  so far). The client shop claims that it's happening about once an
  hour.

  Thanks to some leads from Khan (http://groups.google.com/group/google-
  web-toolkit/browse_thread/thread/f8059139eab52ccf), I'm now trying to
  monitor the requests and responses to see if there's a pattern to
  these seemingly intermittent errors, specifically request header
  content-length that doesn't match the request body length.

  Still, if anyone has any ideas or suggestions, I'd appreciate hearing
  from you. Thanks.

  On Dec 15, 1:55 pm, Phil Petree phil.pet...@gmail.com wrote:
   I would try using a later version of proto on just that page.
   On Dec 15, 2011 1:43 PM, web_dev_ajax lily.o...@gmail.com wrote:

I have a B2B web application that is developed on Struts JSP using
Prototype JS library (version 1.4.0) for AJAX. I have a client running
my application on IE8. She is intermittently getting the http status
code of 12019 (this is an IE specific status code for
ERROR_INTERNET_INCORRECT_HANDLE_STATE). She is the only person in the
client shop that gets the error and she cannot consistently reproduce
the error. However, after she gets the error, she can close her
browser and logs in again to go to the same page as before and not get
the error.

Initially the client shop was on IE6 SP2 and all the users got the
error 12019 intermittently also. After researching on the internet, we
recommended that they upgrade to IE8 to see if the error is resolved
because error 12019 is widely associated with IE6. Now that everyone
in the client shop has upgraded to IE8, and after about 2 months after
the upgrade, one user is beginning to get the error 12019 again. We
have been unable to reproduce the error under various scenarios in
Development.

One more thing to add, in one instance, the user that was getting the
12019 error code also got an exception message coming back from the
AJAX call. The exception message is: System error: -2146697208.

Googling this exception message indicates that it is tied to the error
The download of the specific resource has failed. The same message
has been seen before by the same client when they were on IE6, but on
IE6, they saw the explicit message rather than the exception code.

Does anyone have this similar problem or know of a fix or know of a
way for me to reproduce this in order to find a solution?

Any help is appreciated. Thank you.

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

[Proto-Scripty] Re: Be sure to buy a book Protorype.js and Sript.aculo.us you fall off 90% of questions.

2011-10-04 Thread Eric
Marty,

I think Buda is referring to Christophe Porteneuve's Prototype and
script.aculo.us while the ISBN you gave is for Andrew Dupont's
Practical Prototype and script.aculo.us.
I read Christophe Porteneuve's one and it is a really good start for
prototype. The only drawback for me is that server code for examples
is in Ruby, but beside this little annoyance (only if you're not into
Ruby) it was a great and helpful book.

For Christophe's one:
ISBN-10 1-934356-01-8
ISBN-13 978-1-934356-01-2

IIRC, both authors are or where part of prototype core team, so any of
those books should do the thing.

Eric

On Oct 1, 7:10 pm, Marty Amberg mar...@edenstreet.com wrote:
 I agree, I own the book and it is helpful.  My only complaint is that
 the examples are using ajax calling javascript but I suppose that is
 universal so good for everyone.  A nice ebook to have as well as paper

 ISBN-13 (pbk): 978-1-59059-919-8
 ISBN-10 (pbk): 1-59059-919-5
 ISBN-13 (electronic): 978-1-4302-0502-9

 apress has good stuff and their deals of the day can have some gems.

 On 10/1/2011 10:21 AM, buda wrote:







  Since I bought it - it became my reference book, not only on
  Prototype.js but on JavaScript.

  I periodically reread it each time discovering new nuances. The more I
  read it - the more I fall in love with Prototype.js.

  What an elegant architectural solutions! What is non-trivial syntax!
  JQuery, compared with Prototype.js - technical Library. Prototype.js
  is - the art of programming!

  Everyone must have this book. You will become better understood not
  only the work of the library, and JavaScript in general.

-- 
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: can evalJSON handle currency symbols like €, £, $

2011-09-05 Thread Eric
Are you sure your returned json is encoded in UTF-8?

By using something like FireBug, you can see what is actually returned
from the server. This would be a priceless information to understand
your issue.

On Sep 2, 3:57 pm, nigeke...@googlemail.com
nigeke...@googlemail.com wrote:
 When I download my json string, I run an alert(json) and can see the
 price e.g. €2.99.

 But when I use json.evalJSON(), the price string becomes undefined.

 Is this a known issue? IS there a workaround?

 Thanks

 Nigel

-- 
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: Why Element.Storage?

2011-08-29 Thread Eric J. Van der Velden
Hello Victor,

I already did. But I don't know the answer.

Thanks,

Eric J.

On Aug 29, 8:09 am, Victor vkhomyac...@gmail.com wrote:
 Hi!

 If you like to browse source code, then you can answer by yourself. Just
 search for prototype_event_registry in sources.

-- 
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] Why Element.Storage?

2011-08-27 Thread Eric J. Van der Velden
Hello,

The function Element.observe first lets _createResponder create a
responder. Then it calls
element.addEventListener(actualEventName,responder,false)

This seems enough. Why stores _createResponder the responder in
Element.Storage (behind a index connected with 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.



[Proto-Scripty] Re: Organizing my dom:loaded event

2011-08-24 Thread Eric
Hi,

It may be a little slower as says Victor.
However, you may try to use part of the class to identify a
pluginclass and the other part for identifying the JS class to use.
Something like that:

$$(*[class^='plugin']).each(function(e) {
  var jsClass  = e.className.substr(6);
  if(typeof(window[jsClass])=='function') new (window[jsClass])(e);
});

if you have an UL with class pluginTabs, it will make a new Tabs(e)
on it.

Note that the above code is not tested at all. You may need to found a
proper way to check if the class actually exists and you may need to
use another selector operator than ^= since classes are space
separated sets (sorry, I don't have time to check the documentation).

On a ground to earth approach, I'd continue doing what you're doing
right now.
Only difference perhaps is that I'd add to my plugin classes a static
method which do the selection and DOM update, so you can give an array
of class objects to your DOM init and invoke it.

Eric
On Aug 23, 10:04 am, Johan Arensman johanm...@gmail.com wrote:
 Hey guys,

 I'm redesigning a template set for different kind of websites. In the past
 quite a lot of 'widgets' have been created in the form of prototype Classes
 and almost every widget works the same way:
 1. get all elements with className 'x'
 2. for each element: create a new ClassX
 3. ClassX modifies the element or does something else with it

 for example for a 'Tabs' class this piece of code is in the dom:loaded
 event:
 $$('ul.tabs').each(function(list) { new Tabs(list); });

 Now i'm fine with that for now but imagine to duplicate the same behavior
 for 8 other usages, so 8 other selections are made and JS code is executed
 for them.

 I would like to know if there's any way to optimize the dom:loaded event.
 I'm not having any problems right now, it works just fine but I'm afraid
 that if more functionality is added that performance will become a problem.

 One of my ideas was to combine the global element selectors into 1 selector
 and then apply the correct piece of code by checking if a certain class or
 attribute is present on the element like this:
 $$('ul.tabs, div.map, input.placeholder, a[rel=external]').each(function
 applySomething(e) {
  // if element hasClassName('tabs') then apply tabs functionality etc..
  // more checking for classnames and attributes

 });

 Is this a good idea? Do I gain performance when doing this? Are there other
 ways to organize this?

 All input welcome!

 Greetings,
 Johan

-- 
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: CSV to Json

2011-08-22 Thread Eric
Jason,

Why do you copy the return array into an other one before using it?
(and why rewriting code already available as native PHP functions?)

This should do the same than your code:
$fh = fopen($filename);
$fields = fgetcsv($fh);
while($line = fgetcsv($fh) !== false)
{
  print json_encode(array_combine($fields,$line));
}
fclose($fh);

Eric

PS: You may want to add some error handling :o)


On Aug 20, 6:03 pm, Jason jwestbr...@gmail.com wrote:
 I would use a small PHP script (assuming the first line is the field
 names)

 $fields = array();
 $data = array();
 $fh = fopen($filename);
 $line = fgetcsv($fh);
 foreach($line as $n)
 {
 $fields[] = $n;

 }

 while($line = fgetcsv($fh) !== false)
 {
 foreach($line as $key = $n)
 {
 $data[$fields[$key]][] = $n;

 }
 }

 print json_encode($data);

 seehttp://us.php.net/fgetcsvfor more examples

 On Aug 18, 11:24 pm, kstubs kst...@gmail.com wrote:







  Any tips for converting CSV to Json?  I have CSV, row deliminted \n, and
  fields delimited with typical comma.  There is a known/exisiting object type
  for each field.  Something like:

  {'fields': [{'field':'fname', 'col':2}, {'field':'ssn', 'col':5}]}

  So I have that to work from, and will populate a Json result like this:
  [{'data':{'fname':value}, {'ssn':value}},{'data':{'fname':value},
  {'ssn':value}}]

  I feel like I am doing it the long way when I:

  // split csv string by \n to new line array

  // for every item in new line split string

  // split item by , to field array

  // for every item in field array

  // create object to add to new data array

  Any ideas would help.

  Thanks,
  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.



[Proto-Scripty] Re: Best way to show / hide a menu

2011-07-20 Thread Eric


On Jul 19, 5:12 am, pedz pedz...@gmail.com wrote:
 That helped me!  One question:

 Would this apply to hover as well?  (i've let to own a smart phone.)  i.e.
 stay away from hover?

You can see what events are managed by mobile browsers on this page:
http://www.quirksmode.org/m/table.html

Also note that mobile browsers have special events like the ones on
http://www.quirksmode.org/mobile/tableTouch.html

Kangax had a very nice events testing page which seems to be offline
(http://yura.thinkweb2.com/isEventSupported/)

Eric

-- 
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 your favorite error status code?

2011-07-12 Thread Eric
Walter,

What I do in those case is:
- Returning my own error code in a JSON's attribute (lets use
myJsonStatus for the example)
- Use AJAX.Responders to override onCreate to wrap the provided
onSuccess into a custom function which checks
responseJSON.myJSONStatus and do appropriate processing if present or
call provided onSuccess handler if it is not.

I only use this for unrecoverable errors but I guess you may provide
to your Ajax.Request custom handlers like
onMyPrivateAppStatusUserDidSomethingWrong and call it if your
myJsonStatus is 'UserDidSomethingWrong' (you may of course use
numerical codes, but example is then less funny :o) )

(untested) implementation:

Ajax.Responders.register(
onCreate: function(r) {
  r.options.onSuccess = (r.options.onSuccess||
Prototype.emptyFunction).wrap(function(localCB,xhr,xjs){
var js = xhr.responseJSON || {myJsonStatus:'MalformedJSON'};
if(js.myJsonStatus){
  (r.options['onMyPrivateAppStatus'+js.myJsonStatus]||
Prototype.emptyFunction)(xhr,xjs);
}
else {
  localCB(xhr,xjs);
}
  });
});


usage:

new Ajax.Request('myAjaxScript.php',{
  parameters: {'whatever':'is needed here'},
  onSuccess: function () {...},
  onMyPrivateAppStatusUserDidSomethingWrong: function() {...},
  onMyPrivateAppStatusMalformedJSON: function() {...}
});

Eric

On Jul 7, 2:27 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 On Jul 7, 2011, at 8:21 AM, T.J. Crowder wrote:

  To my mind, HTTP response codes aren't for application logic
  signalling. They're for signalling between the browser and server. The
  correct response to bum data from the user is a 200 with an
  application-logic-level success/error flag.

 Fair enough, but since the onFailure callback only runs if the  
 response code sent back is something other than the 200 range, how  
 would you recommend I send back that failure other than with the  
 status code?

 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.



[Proto-Scripty] Re: Registered events and removed DOM objects

2011-06-17 Thread Eric
Element.purge() Yet another prototype 1.7 feature I was not aware
of :o)

Is there any way to export this online documentation into a convenient
PDF or anything I can print and turn into a book like the one for
prototype 1.6?

Eric

On Jun 16, 10:44 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 On Jun 16, 9:11 am, Acu woj...@studioatrium.pl wrote:

  I am curious what happens with references to Events registered through
  Event.Observe when object bound with those evenst is removed with
  Element.remove function. Are they automatically freed (like with
  Event.unloadCache)? Or maybe one should unregister those events with
  Event.stopObserving before removing object?

 Prototype doesn't do anything to remove the handlers on `remove`,
 they'll stay in memory.

 If you know you've only set handlers on that element and none of its
 children, yes, use `stopObserving`:

     $(theElement).stopObserving().remove();

 If there may be handlers on the element's children as well, use
 `purge`[1]:

     $(theElement).purge().remove();

 It's not clear from the documentation, but `purge` does remove
 handlers from the element's descendants.

 [1]http://api.prototypejs.org/dom/Element/purge/

 HTH,
 --
 T.J. Crowder
 Independent Software Engineer
 tj / crowder software / com
 www / crowder software / 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.



[Proto-Scripty] Re: A bit of assistance please

2011-06-09 Thread Eric
Yes I mean that.
After googling, it seems that it is a know issue with chrome for
mobile to not show scrollbars when using overflow:auto...


On Jun 6, 4:09 pm, Walter Davis wa...@wdstudio.com wrote:
 On Jun 6, 2011, at 9:26 AM, Eric wrote:

  I did try it on Chrome on Windows with success:
  Google Chrome      11.0.696.77 (Build officiel 87952)
  WebKit     534.24 (branches/chromium/696@86868)
  V8 3.1.8.16
  Agent utilisateur  Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/
  534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24

  I tried on Android 2.3.4's native browser (Chrome Mobile, no idea of
  the version number) but the scrollbar is missing, so no way to know if
  the property is supported.

 Try two-finger dragging within the scrolled text box, that works on  
 MobileSafari, but no idea if it also works in Android. (Hey, they've  
 stolen every other idea, why not that...)



  It also works on Linux/Firefox3.5.7

 So by works, you mean both the Prototype version and the native  
 version of the offset calculation reported the same offset number  
 while you scrolled?

 Walter



  Eric

  On Jun 3, 5:55 pm, Walter Davis wa...@wdstudio.com wrote:
  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 
  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 
  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.



[Proto-Scripty] Re: ajax.updater - json to fill select

2011-06-06 Thread Eric
Hello,

This is a little out of topic, but here are few hints:
The easiest way to do that is to build a PHP array, and to use
JSON_Encode to convert it into a JSON encoded string;
You also need to change the content-type of your response to let
prototype know it is actually JSON.

Simple example:
?php
$myCities = Array(Paris,Madrid,New-York,London);
header('Content-Type: application/json');
print json_encode($myCities);
?

Eric


On Jun 4, 11:15 am, Johan Arensman johanm...@gmail.com wrote:
 You can use basic Json, but this is basic javascript, not specific for
 prototype

 {
  cars: [
   {
     make: 'some make name',
     models: [
       { name: 'model 1' },
       { name: 'model 2' }
     ]
   },
   {
     make: 'some other make name',
     models: [
       { name: 'model 3' },
       { name: 'model 4' }
     ]
   },
  ]

 }

 Something like this?

 Greets,
  Johan

 On Fri, Jun 3, 2011 at 9:31 PM, Phil Petree phil.pet...@gmail.com wrote:
  Hey All!

  I'm biting the bullet and trying to break away from XML and go to json.

  I using Ajax.Updater to call cities.php which looks up the available cities
  for a given zip code (yes there can be more than one city - my zip has 4
  possibilities!) and return those in a select

  How do these need to be returned/formatted in php?

  Can anyone point me to one of the car/make/model examples?  I can't find
  one for prototype...

  Thanks,

  Pete

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



[Proto-Scripty] Re: A bit of assistance please

2011-06-03 Thread Eric


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.

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.



[Proto-Scripty] Re: what is the advantage to use Class.create to create new class

2011-06-01 Thread Eric


On May 31, 4:35 pm, maven apache apachemav...@gmail.com wrote:
 2011/5/31 Johan Arensman johanm...@gmail.com

  Hi,

  Mostly because with Class.create() you can make use of the various
  inheritance functionality in the Prototype framework.

 But I see the prototype source code,the Class.create() just return a
 function,can not find any inheritance functionality

That may be because you're using prototype 1.4.
You may consider upgrading to 1.7.

Eric




  Seehttp://api.prototypejs.org/language/Class/create/for more
  information.

  Greetings,
   Johan

  On Tue, May 31, 2011 at 3:26 PM, maven apache apachemav...@gmail.comwrote:

  Hi:

  I am using prototype1.4 now.

  When create new class using prototype ,people used to use this manner:

  var Person = Class.create();
  Person.prototype = {
     initialize: function(name) {
       this.name = name;
     }
     printName: function() {
       alert(this.name);
     }
  }

  However I can not see the advantage of this manner,since it is very
  readable when use the native javascript:

  function Person(name) {
      this.name = name;
  }
  Person.prototype = {
      printName: function() {
          alert(this.name);
      }
  }

  Anyone can tell me why?

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



[Proto-Scripty] Re: Updating Observer through AJAX call

2011-05-31 Thread Eric
By Ajax call, do you mean an Ajax.Request or an Ajax.Updater ?
If you use an Ajax.Request, I am kind of sure you can do anything in
your onSuccess, including observing new events.
If you use Ajax.Updater which return some embedded script tag, it
should work if you ensure option evalScripts is true (but it should be
ok since it works in other browsers).

I recommend you use debug tools recommended by Miguel to have a close
look at the AJAX calls (check headers and content of both request and
response) and figure out what is different between working browser and
chrome.

Wild guess : chrome may send different headers to your server, causing
the server to reply with different headers, which do not allow
javascript to be executed for some reason.

There is also some limitation for functions created in script tags
embedded in an Ajax.Updater:
function f() {...}
will not work, but something like this will:
f = function() {...}

Please let us know when you found what was wrong.

Eric

On May 31, 6:14 pm, Kristofer krishop...@gmail.com wrote:
 On Tue, May 31, 2011 at 10:57:36AM -0500, Miguel Beltran R. wrote:
  2011/5/29 Kristofer krishop...@gmail.com

   Hello,

   I am trying to figure out how to do this properly.

   I have a site with two dropdown boxes, one for a Color and one for a
   Size.  Using Event.Observe() I attach a listener to both.  When one is
   selected, it performs an AJAX call to update the contents of the other
   to show sizes or colors available, and there is also another
   Event.Observe() in the AJAX call so that when the updated field is
   changed, it updates another element with an Add to Cart link and a
   price.

   This works in both IE and Firefox, but Chrome doesn't seem to be
   listening to the new click event that is attached through the AJAX
   call.

   Does anyone have any suggestions as to what I may be missing?

  are you tried Chrome Developer Tools or Firebug lite?

 http://getfirebug.com/releases/lite/chrome/

  I don't use Chrome, do have something like console errors?

 There aren't any errors.

 I guess what my question is more pointed at is: is it proper to add a
 new listener through javascript code which is passed back through an
 AJAX response?

-- 
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: A bit of assistance please

2011-05-30 Thread Eric
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).

Eric

On May 29, 12:29 pm, bill will...@techservsys.com wrote:
 On 5/29/2011 12:56 AM, venu gupta wrote: Hi Bill,
         You can do both the ways . But I personally prefer to
  have it in the main page which is always loaded.

 I obviously sounded as if I know more than I do.
 I need some help in the form of the observer and with determining
 the x/y location of the click and/or determining the id of the
 div clicked upon.





  On Sun, May 29, 2011 at 12:58 AM, bill will...@techservsys.com
  mailto:will...@techservsys.com wrote:

      I am dynamically generating a div which is loaded via AJAX.
      It is a schedule, with a background image (loaded with
      img..., not css - so it scrolls) and the appointments as
      superimposed divs.

      If the user clicks on the background image (not on a div) I
      need to determine the x and y coordinates of the click on
      the image, not in the viewport. (ie: the same coordinates
      regardless of how the image has scrolled)

      If the user clicks on a div (superimposed on the image) I
      need to return the id of the div.
      It seems that I could just have one observer watching the
      outer div and bubble up the information, but I just can't
      seem to get started.

      I can load the js with the page or I can have it in the
      main page that is always loaded.

      --
      Bill Drescher
      william {at} TechServSys {dot} com

      --
      You received this message because you are subscribed to the
      Google Groups Prototype  script.aculo.us
      http://script.aculo.us group.
      To post to this group, send email to
      prototype-scriptaculous@googlegroups.com
      mailto:prototype-scriptaculous@googlegroups.com.
      To unsubscribe from this group, send email to
      prototype-scriptaculous+unsubscr...@googlegroups.com
      mailto:prototype-scriptaculous%2bunsubscr...@googlegroups.com.
      For more options, visit this group at
     http://groups.google.com/group/prototype-scriptaculous?hl=en.

  --
  Regards,
  Venu Kumar Bukka
  --
  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.



Re: [Proto-Scripty] problem with prototype.js and dashcode

2011-03-26 Thread Eric Sandeen
On 3/25/11 7:24 AM, Walter Lee Davis wrote:
 Try loading prototype before main.js and see if the problem goes
 away. Or try wrapping self.animations with $A(), which will return an
 extended array.
 
 Walter

Thanks for the suggestions; loading prototype.js just before main.js
doesn't help, but loading it before AppleAnimator.js in main.html does.
Hopefully that won't break much.   ;)

Thanks,
-Eric

 On Mar 25, 2011, at 1:21 AM, Eric wrote:
 
 I'm using Dashcode 3.0.2 on OSX 10.6.6, and trying to write my
 first dashboard widget using prototype.js 1.7.
 
 I've got some things working, but as soon as I mouse over the
 running widget, I get a:
 
 Result of expression 'array' [undefined] is not an object
 
 I'm not sure how I got to it, but it's in AppleAnimator.js, and 
 'array' came from array = self.animations;
 
 A simple reproducer is:
 
 Create a new custom project. Add prototype.js to the file list. 
 Add prototype.js to main.html right after main.js Run the project,
 mouse over  boom.
 
 I'll admit to being a total noob at this, but I can't tell what's
 gone wrong here.
 
 Thanks, -Eric
 
 -- 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.



[Proto-Scripty] Re: jqTouch-counterpart for Prototype?

2011-03-22 Thread Eric
Hi,

I don't want to launch a troll here but it seems that scripty2 doesn't
support Android phones' browser very well... (no scale and no rotation
supported)

jqtouch kind of works but most animations are disabled (the last
frame of animation is displayed right away).

Ways to go before we get something as universal on mobile internet
than prototype.js on immobile internet :o)

Eric


On Feb 28, 9:26 am, Benedikt.Rothe benedikt.ro...@googlemail.com
wrote:
  It has support for touch events -http://scripty2.com/demos/touch/

 This is very interesting. I didn't know. Thank you.

 But jqTouch is still different: It provides JavaScript+CSS to
 give your WebApp a typical IPhone Look-and-feel: Sliding Menues, Full-
 Screen-Support,

 Without any doubt Scriptaculous/Scripty animations will be extremly
 usefull, to produce these effects.
 But I think this is just the basis and it would be nice, if there
 would be more.

 http://jqtouch.comhas a Flash animation.

 Benedikt

 On 26 Feb., 23:53, Gappa pavel.linh...@gmail.com wrote:

  Hi,

  you could try the new beta version of Scriptaculous -http://scripty2.com
  It has support for touch events -http://scripty2.com/demos/touch/

  On Feb 26, 10:52 pm, Benedikt.Rothe benedikt.ro...@googlemail.com
  wrote:

   Hi

   On top of jQuery exists a lib called jqTouch:http://www.jqtouch.com

   It provides Javascript and CSS to create Apps for iPhone in the
   typical-
   iPhone look and feel.

   Since I'd prefer to use Prototype instead of jQuery I want to know
   whether there is a jqTouch-counterpart in the Prototype-Universe

   Thank's
   Benedikt



-- 
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: prototype 1.7, scriptalulous 1.9.0, FF 4.0 beta 9

2011-01-19 Thread Eric
Hi,

I did have the second issue you have (regarding dragging from divs
with scrollbars) a couple of months ago, but didn't get any helpful
reply from the list (too specific issue perhaps).
I am sorry but the only way I could fix it was to undust my pre-
prototype drag'n drop code.

However, the big part of the trick is to have a hidden div in the root
of the dom (not into your scrollable div) (let's call it the X div)
and upon mouse down on the draggable item do the following:
- copy innerHTML from the draggable item into the X div
- move X div exactly on top of draggable item
- show X div (and hide draggable item)
- drag X div

I did that using proprietary code, but it should be possible to do
that with scripty's draggables (and then to be able to use all nice
features like ghost).

If you successfully implement this, don't hesitate to share it ;o)

Eric

On Jan 16, 6:24 pm, Ben Perry b3npe...@gmail.com wrote:
  ...After some investigation, if I put ghosting: true on each
  draggable, then they don't drag at all.

 Whoops, this isn't the case, must have got mixed up whilst testing.
 The second page with just spans or the table (provided they both have
 ghosting:true set) exhibit the same behavious. The dragged item
 doesn't return to its position.

 This can be replicated in FF 3.6.13 too.

-- 
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] Dragging from an overflow: auto container

2010-11-19 Thread Eric
Hi,

I have a fairly big amount of draggable items that I've placed into a
fixe sized div with overflow: auto style.
I was hoping being able to scroll in that div until I found the item I
want to drag and then drag it outside of the div.

Of course, when I try to drag the object out of the div, it disapears
and the div's scrollbars shows that it is still in the div.

Here is what I tried first :

http://jsbin.com/ubodi4

I thought that using ghosting would help, but if I can now drag the
items out of the div, they disappear from it (according to the doc, it
should create a copy of the item and drag the copy, not removing the
item...):
To be accurate, the item disappears on chromium 6, but is moved on
window pos 0,0 (top left) on Firefox 3.5.5

http://jsbin.com/ubodi4/2

Using both ghosting and revert didn't help (only difference is that
now chromium act like FF):

http://jsbin.com/ubodi4/3

Worst: If the div has style position: absolute, it is again not
possible to drag items out of the div :o(

http://jsbin.com/ubodi4/4

Until now, I was using my own drag'n drop lib that handled this
correctly, but I am trying to migrate toward prototype/scripty and I
would really would like to achieve the same result with scripty's
drag'n drop.

Not sure it would help, but what my lib was doing is creating a
ghost from the dragged object which was a direct child of the body.
Is it possible to override the ghosting step in scriptaculous's
drag'n drop?

I've spend more than 3 hours trying exotic ways of fixing it, and
there isn't much I can think of.
Any hint/idea is welcome :o)

Eric

PS: Here is the code I use in case you don't want to go on jsbin:
var list = $('list');
var i;
for(i=1;i20;++i)
{
  var elt = new Element('span').update('item '+i);
  new Draggable(elt,{ghosting:true});
  list.insert(elt);
}

PS2: sadly, jsbin's edit preview still doesn't work on Firefox, so
you'll need another browser if you want to interactively edit/test 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-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 no works on Chrome - decoding fails

2010-11-10 Thread Eric
It may be helping if you could trace and post here the following
things :
From Javascript:
- requestObject
- JSON.stringify(requestObject)
From PHP:
- $this-getRequest()-getRawBody();
- rawurldecode($this-getRequest()-getRawBody());

Also, why do you need to use JSON.stringify thing when, as T.J. told
you (twice) prototype is designed to take care of it for you.

Eric

On 10 nov, 00:37, fashionpeople fashionpeople.busin...@gmail.com
wrote:
 I tried use fixedEncodeURI like suggest in your links.

 But doesn't work.
 I didn't understand the problem.

 On 9 Nov, 17:25, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

   I replaced escape with encodeURI. But decoding fails again.

  Well, did you try actually doing what I suggested?

  -- T.J.

  On Nov 9, 4:07 pm, fashionpeople fashionpeople.busin...@gmail.com
  wrote:

   Hi,

   I replaced escape with encodeURI. But decoding fails again.

      function sendMessage(baseUrl, idNickRcv, msg) {

         var requestObject       = new Object();
         requestObject.idNickRcv = idNickRcv;
         requestObject.msg       = msg;

         var jsonRequest         = JSON.stringify(requestObject);

         if ((idNickRcv)  (msg)) {

            new Ajax.Request(baseUrl + '/usermsg/index/sendmessage', {
               method:     'POST',
               requestHeaders:{ Accept:'application/json' },
               parameters: encodeURI(jsonRequest),

                            onSuccess:
                             function(transport, json) {
                             //use and handle foo response data
                            }
                            ,
                            on500:
                             function(transport) {
                             //handle error, inform user
                             },
                            onComplete: parseSendMessage

                  });

         }

   php:

         $request       = rawurldecode($this-getRequest()-

   getRawBody());

   // HERE DECODING FAILS AND EXECUTION IS INTERRUPTED.
         $requestObject = $zendJson-decode($request,
   Zend_Json::TYPE_OBJECT);
         $msg           = $requestObject-msg;
         $idNickRcv     = $requestObject-idNickRcv;

   On 8 Nov, 23:11, Walter Lee Davis wa...@wdstudio.com wrote:

Right. The best low-level way to translate JS to PHP and back again is  
using encodeURI or uncodeURIComponent on your JS side, and  
rawurldecode() or rawurlencode() on the PHP side. They are  
functionally identical, as long as you have set your PHP side to use  
UTF-8 as its default charset.

Walter

On Nov 8, 2010, at 4:42 PM, T.J. Crowder wrote:

 Hi,

 I don't know that it's the problem because I'm not a PHP person, but
 you're using the `escape` function to encode your parameters, and then
 decoding them with a PHP function called `urldecode`. JavaScript's
 `escape` function does _not_ URL-encode things, it does something
 similar but different and is almost certainly not what you want. I'm
 surprised it's working with other browsers, frankly, but perhaps
 that's my lack of PHP knowledge.

 The most reliable way to send parameters that I know is to send them
 URL-encoded, and to decode them as URL-encoded data. In Prototype, the
 easiest way to do that is to supply a plain object to the Ajax.Request
 method (which Prototype will correctly encode for you):

    var jsonRequest = ...;
    new Ajax.Request( // ...
        parameters: {json: jsonRequest}
        // ...
    });

 ...and then retrieve the value just as you would any other value:

    $request = $_POST[json];
    $requestObject = Zend_Json::decode($request); // Or your
 $zendJson, whatever that is

 But again, I'm not a PHP guy and could easily be missing something
 important here.

 FWIW,
 --
 T.J. Crowder
 Independent Software Engineer
 tj / crowder software / com
 www / crowder software / com

 On Nov 8, 5:47 pm, fashionpeople fashionpeople.busin...@gmail.com
 wrote:
 Hi,

 this is my ajax request that works perfectly on IE and FIREFOX, but
 not in CHROME!

    function sendMessage(baseUrl, idNickRcv, msg) {

       var requestObject       = new Object();
       requestObject.idNickRcv = idNickRcv;
       requestObject.msg       = msg;

       var jsonRequest         = JSON.stringify(requestObject);

       if ((idNickRcv)  (msg)) {

          new Ajax.Request(baseUrl + '/usermsg/index/sendmessage', {
             method:     'POST',
             requestHeaders:{ Accept:'application/json' },
             parameters: escape(jsonRequest),

                          onSuccess:
                           function(transport, json) {
                           //use and handle foo response data

[Proto-Scripty] Re: ajax.updater and onLoad

2010-11-04 Thread Eric


On Nov 3, 2:44 am, Walter Lee Davis wa...@wdstudio.com wrote:
 If you just want it for one updater, then do this:

 new Ajax.Updater('foo','bar.php', {
         onCreate: function(){
                 $('indicator').show();
         },

Is this actually working?
The Prototype 1.6 Complete API Reference explicitly says that
onCreate is only available to responders, as it wouldn't make a lot
of sense to individual requests .

Eric

-- 
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: adding InPlaceEditor to each table cell

2010-10-29 Thread Eric
I've done that before.
I cannot post the code here because it is in a complex application/
framework but here are the few points you need to make it work:
- Add a classname like 'NeedIPE' to your TD's, and observe the click
on the table or anything on top of it.
- In you event handler, get the clicked TD with something like
e.findElement('td.NeedIPE');
- if there is a TD found, create the InPlaceEditor, and remove the
NeedIPE class, so next time you click on it, a new IPE won't be
created
- Call enterEditMode() 's method of your InPlaceEditor() so you won't
need to click a second time.

Also you may disable the highlight effect of the InPlaceEditor, so the
cells you already clicked wont have different behavior than the ones
you haven't.
(I did at first try to implement the highlight effect on other td's
but with a big table, it is just very bad looking).

Eric

On Oct 28, 12:34 am, BrentNicholas brentnicho...@gmail.com wrote:
 Hi all,

 I've been wrestling with this for a little bit now and figure it's
 time to ask for help. I can't seem to find anything on the web.

 I have a dynamicly generated table, I want to have an InPlaceEditor
 instance on each table cell. From what I can tell you need to do a
 'new' object on it for every cell so that the hover over highlight
 shows, letting you know that the InPlaceEditor is connected to the
 table cell.

 Table Struct:
 (The p tag was what I saw in examples and am using it since that's
 what works now)
 table id=idProgramsTBL
 tr class=mainRow
         td id=tdPrgCdp id=idPrgCdP#ProgramUID#
 class=clsPrgCdP#ProgramCode#/p/td

 I've tried the following, to no avail:

 // this works but has the problem described below
 $('idProgramsTBL').select('[class=clsPrgCdP]').invoke(observe,
 click, function(event){ codeEditInPlace(this.id); });

 // this works but is incorrect as it will create a new instance of the
 InPlaceEditor on each 'click'
 // thus you can get 1 to n editors in the cell for every click
 // Also, this connects the editor after the click, so you end up
 clicking twice
 function codeEditInPlace(id)
 {
         new Ajax.InPlaceEditor(id ,'act_setProgramCode.cfm?ProgramUID='+id,
                 {
                         onFailure: placeError,
                         onComplete: refreshProgramCode,
                         rows: 2,
                         cols: 20
                 }
         );

 }

 The problem is that the above is based on creating and attaching the
 InPlaceEditor when the user clicks, vs after the Ajax.Request
 completes. I am calling the .invoke.observe statement above in a
 function fired by the onComplete call back of Ajax.Request

 So how do I find all the items of this class (class name of table cell
 or P tag) and create a new InPlaceEditor on it.

 I've got the following to get the classes of the P tags in the table
 cells:
 $('idResultsTableTBL').select('[class=clsPrgCdP]')

 I found this but I don't think it's of help:
 var codeCellArray =  $A(['clsPrgCd']);

 codeCellArray.each(function(aCell) {
         alert(aCell);

 });

 Thoughts?

 Thanks for your time,
 Brent

-- 
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: Anchor button triggers window.onbeforeunload in IE

2010-10-25 Thread Eric
Hi JoJo,

It seems you're doing a closure by hand. You may want to look at
Function.bind() or Function.curry() in prototype documentation, since
they do it for you.
Your solution may become :
dynamicAnchor = new Element(
'a', {
href: 'javascript:void(0)'
}
).observe(
'click',
(function(parameter,event) {
window.status = parameter;
event.stop();
}).curry(localVariable)
);

Also note that I am 80% sure (please somebody confirm) that since your
parameter is a local variable, javascript will implicitly create a
closure for you.

In other words, this should work:
var localVariable= 'Hi!';
dynamicAnchor = new Element(
'a', {
href: 'javascript:void(0)'
}
).observe(
'click',
function(event) {
window.status = localVariable;
event.stop();
}
);

T.J.'s blog has many very well written articles that will explain you
why (http://blog.niftysnippets.org/search/label/closures).

Eric

On Oct 22, 8:47 pm, JoJo tokyot...@gmail.com wrote:
 Thanks T.J.

 The solution is:

 dynamicAnchor = new Element(
     'a', {
         href: 'javascript:void(0)'
     }
 ).observe(
     'click',
     function(parameter) {
         return function(event) {
             window.status = parameter;
             Event.stop(event);
         }
     }(localVariable)
 );

 On Oct 22, 4:39 am, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  See the documentation for `Event.observe`[1] (which is what you're
  calling indirectly from the `Element#observe` function), specifically
  the Preventing the Default Event Action and Bubbling part, and the
  `Event` object[2]: You don't return false to cancel the `click` event,
  you use the `Event#preventDefault` function (which is a standard DOM
  function[3] that Prototype ensures is present even on implementations
  that lack it) or, more likely, `Event#stop`[4] which both prevents the
  default action and stops the event bubbling.

  [1]http://api.prototypejs.org/dom/event/observe/
  [2]http://api.prototypejs.org/dom/event/
  [3]http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event-prev...
  [4]http://api.prototypejs.org/dom/event/stop/

  HTH,
  --
  T.J. Crowder
  Independent Software Engineer
  tj / crowder software / com
  www / crowder software / com

  On Oct 22, 2:41 am, JoJo tokyot...@gmail.com wrote:

   I use anchors to call javascript functions. Usually, I do this:

   a href=javascript:void(0) onclick=someFunc(); return false;
      call the function
   /a

   This works fine in all browsers. Window.onbeforeunload is never
   triggered because the ONCLICK returns false, and thus the HREF if not
   executed. When HREF is not executed, the browser does not believe that
   the window in unloading. Now, I'm trying to create a dynamic anchor to
   accomplish the same thing. It looks nearly identical to the HTML
   anchor, but now it's triggering window.onbeforeunload in IE8. How do I
   not trigger it?

   dynamicAnchor = new Element(
       'a', {
           href: 'javascript:void(0)',
       }
   ).observe(
       'click',
       function(parameter) {
           return function() {
               window.status = parameter;
               return false;
           }
       }(localVariable)
   );



-- 
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: Cursor blinker disappears from textarea after a clear()

2010-10-21 Thread Eric
Hi JoJo,

This is more a work around than a fix, but you may try to:
- set the textarea's readonly attribute to true instead of disable it
(that would prevent the user to type anything while letting the cursor
in place)
- add a custom class name to the textarea that make it look disabled
(setting a gray background and dark gray text should do it)

Instead of enabling it again, you just set readOnly to false and
remove the custom class name.

HTH.
Eric

On Oct 20, 11:28 pm, JoJo tokyot...@gmail.com wrote:
 I found out what was causing the issue. In my AJAX to add the comment
 I had:

 onCreate: function() {
    $(foo').disable();}

 onComplete: function() {
    $('foo').enable();

 }

 I commented out these two and the blinking cursor came back. Ideally,
 the textarea should be disabled when the AJAX is processing...

 On Oct 20, 1:36 pm, JoJo tokyot...@gmail.com wrote:

  activate() did not fix it.

  On Oct 19, 11:08 pm, Walter Lee Davis wa...@wdstudio.com wrote:

   Try activate in place of focus, and see if that works for you. Just  
   checking -- you do have Prototype in your page, right?

   Walter

   On Oct 19, 2010, at 9:59 PM, JoJo wrote:

I'm creating a standard chat system. When the user hits the Enter key
in the textarea, I send her comment to the server. Then I clear her
message so she can begin typing a new one. The cursor blinker
disappears when I do this clear. It's better for usability if the
blinking remains. How do I put it back?

textarea id=foo/textarea

$('foo').clear();
// at this point the blinking cursor is gone
$('foo').focus();
// focusing does not put the blinker back

--
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-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: Cursor blinker disappears from textarea after a clear()

2010-10-21 Thread Eric
Oooops,

After reading T.J's message (http://groups.google.com/group/prototype-
scriptaculous/t/38c587197bfb14e7), I noticed that what I called
readOnly attribute was in fact readOnly property.

Sorry for that, and thanks T.J. for teaching me this concept :o)

Eric

On Oct 21, 2:01 pm, Eric lefauv...@gmail.com wrote:
 Hi JoJo,

 This is more a work around than a fix, but you may try to:
 - set the textarea's readonly attribute to true instead of disable it
 (that would prevent the user to type anything while letting the cursor
 in place)
 - add a custom class name to the textarea that make it look disabled
 (setting a gray background and dark gray text should do it)

 Instead of enabling it again, you just set readOnly to false and
 remove the custom class name.

 HTH.
 Eric

 On Oct 20, 11:28 pm, JoJo tokyot...@gmail.com wrote:

  I found out what was causing the issue. In my AJAX to add the comment
  I had:

  onCreate: function() {
     $(foo').disable();}

  onComplete: function() {
     $('foo').enable();

  }

  I commented out these two and the blinking cursor came back. Ideally,
  the textarea should be disabled when the AJAX is processing...

  On Oct 20, 1:36 pm, JoJo tokyot...@gmail.com wrote:

   activate() did not fix it.

   On Oct 19, 11:08 pm, Walter Lee Davis wa...@wdstudio.com wrote:

Try activate in place of focus, and see if that works for you. Just  
checking -- you do have Prototype in your page, right?

Walter

On Oct 19, 2010, at 9:59 PM, JoJo wrote:

 I'm creating a standard chat system. When the user hits the Enter key
 in the textarea, I send her comment to the server. Then I clear her
 message so she can begin typing a new one. The cursor blinker
 disappears when I do this clear. It's better for usability if the
 blinking remains. How do I put it back?

 textarea id=foo/textarea

 $('foo').clear();
 // at this point the blinking cursor is gone
 $('foo').focus();
 // focusing does not put the blinker back

 --
 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-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: Scalable Drag Drop (without noticeable lag)

2010-10-19 Thread Eric
Hi Scott,

I didn't do much with drag/drop using scripty, but can't you just have
one droppable (in your case it would be $('cats')) and find out which
span was under the mouse when a drop occurs?

In the same spirit, instead of adding a onmouseover event on
each .drag item, you may add one on your body (or on your two ULs if
you prefer), and test if the event happened on one .drag element
(something like if(elt=event.findElement('.drag')) ...).

Last point: I don't know if it is possible, but did you try to create
the draggable on the mousedown instead of the mouseover?
It will save lots of work to the browser (It would require some
tweaks, but I successfully used this technique with
Ajax.InPlaceEditor).

Eric

-- 
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.PeriodicalUpdater not working in IE

2010-10-11 Thread Eric
On Oct 9, 8:57 am, asb ast.bha...@gmail.com wrote:
 Ajax.PeriodicalUpdater is not working in IE [9]. Tested in other
 browser its working.

 Help Needed

Dear asb,

I am sure that plenty of people here are willing to assist you, but
is not working is usually not enough information to allows anybody
to help you in efficient way (neither is is not working in IE [9]).
Do you mean that :
- it raises an execution error? (in this case, which error message do
you get?)
- it doesn't do what you expect it to do? (in this case, what does it
do?)

Also note that AFAIK the IE9 beta is not yet officially supported by
prototype.
If you try to use it already, you may need to put hands in the source
(once again, if you give more information about what you're trying to
do and what is actually happening, I am sure you will get some help
for solving your issue).

Best,
Eric

-- 
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: marquee in JavaScript (using Prototype)

2010-09-24 Thread Eric Anderson
On Aug 27, 5:43 am, Johan Arensman johanm...@gmail.com wrote:
 I'm fully against marquee's in the first place but you also have an option
 to add the attribute data-duration to your element. If you're making a class
 to replace a depricated functionality you shouldn't use this way to add
 features or configuration to it.

I'm not sure I understand? Isn't data- the new HTML5 way to do custom
element configuration?

-- 
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: Prototype return limited

2010-09-21 Thread Eric


On Sep 10, 11:32 pm, chrysanthe m chrysant...@gmail.com wrote:
 Hi Dave
 Yes.
 I know I should not be shoveling out so much data to the client, but I have
 to for this proof of concept and will restrict it in production.  Has anyone
 parsed return json data larger than 8K?

I did.
Note that:
- I am using the response body (responseJSON) and not the response
header.
- I noticed that my server uses Transfer-Encoding: chunked (in case
it may have an effect, since for shorter replies it uses gzip and
give a Content-Length) .

HTH
Eric


 On Thu, Sep 2, 2010 at 9:27 AM, Dave Kibble davekib...@gmail.com wrote:
  just going on the number 8k (IE limit) and the ambiguity of return: do
  you mean that ajax fails when sending 8k to the server, or when the reply
  to an ajax request from the server is 8k

   --
  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.comprototype-scriptaculous%2bunsubscr...@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-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] marquee in JavaScript (using Prototype)

2010-08-25 Thread Eric Anderson
For those that miss 1998 when the marquee element was still valid I 
got a quick script I put together yesterday which does similar 
functionality. It moves the content using scrollLeft instead of CSS 
which I believe results in smoother animation on less desirable browsers 
such as IE.


http://gist.github.com/548690

The gist includes an example usage HTML document. Although marquee is a 
bad thing in most situations there are a few valid use cases. So for 
people looking for something like this it is free for all to use however 
they see fit.


Eric

--
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: Script.aculo.us + Prototype scripts not working on my server

2010-08-18 Thread Eric
I did see this strange behavior on a couple of computers (same code of
course working nicely on other computers).
My fix was to stop using scriptaculous.js and include directly all
scriptaculous modules I needed (in your case, effects.js should be
enough).

However, unless you need your site to run on an intranet or an offline
computer, you may keep googleapi links.
It will optimise the browser's cache, and it is very likely that
google servers will serve your scripts faster than your hosting
company.

Eric

On Aug 16, 10:54 am, ColinFine colin.f...@pace.com wrote:
 On Aug 13, 6:43 pm, chad.goodwin chad.good...@gmail.com wrote:



  I was looking for a way to make an image scroller.
  I found Scriptaculous'   effect.move works very well.
  In fact I found a working example.

  So I went and downloaded the newest version from the Script.aculo.us
  site.
  I unzipped the files and uploaded them to my javascript folder.
  I copied the example code verbatim and it worked.
  However, I noticed the example code was linking 
  tohttp://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculou...
  I changed it to point to my scriptaculous.js in the javascript folder
  and it stopped working.

  I have checked that the files are there in the proper directory and
  the linking is correct.
  I even tried moving the .js files into the same directory as the web
  page and linking it by calling scriptaculous.js.

  Am I installing this wrong?
  Is there more I need to do?
  Do the Javascripts only work on certain types of servers?

 Have you verified that the js files are actually being loaded?
 I don't know what server you are using, but certainly with Apache it's
 easy to get your paths, aliases or permissions wrong (and it won't
 normally tell you where it is actually going to find a file).
 I would look at it in your browser debugger and make sure that the js
 file is loading.

 The type of server is irrelevant to the libraries, but may be relevant
 to where they are looked for :-)

-- 
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: Introducing AutoTable, new Table/Grid widget

2010-08-18 Thread Eric
Hi

On Aug 15, 5:12 pm, Blaine blaine.simp...@admc.com wrote:
 The way you suggest how to hand the sort gesture is how I implemented
 it first.  The result is terrible because the th click and drag
...
Why do you have a a in your th?
You could use the mouseup of the th.

In order to avoid flickering, you may not move the th upon drag until
mouse has moved at least, lets say 5 pixels.
I already meet this kind of issue with a custom made treecontrol where
nodes could be both clicked and dragged.
The way I did it:
- Just implemented the drag and drop
- on the drop, if the node is dropped on itself (its position has not
moved from more than 4 pixels) I throw my drop on self event (which
is really a click event in this case).

It works fine on production for many years now and tens of users[1]
are happy using it daily :o)

 I don't understand your suggestion about tab key, since that has been
 implemented and working since I first added editing, with the

Well, I tried again and it seems to work now, except that your online
demo is triggering an alert everytime now :o(

 significant limitation that the cycle ends when it opens a dropdown-
 list-editor.  This is because my custom dropdown-list-editors can not
 take focus.  It would take much more time than I have now to make the
 dropdown-list-editors able to capture keystrokes.  The only reason
 that I have to use a custom list editor is that it's impossible to
 programmatically trigger an open of a HTML select element.

Hum, it is not very nice to have some action only possible with
mouse...
It can me ok with easy life features like reordering columns or
sorting, but not being able to edit the table content without a mouse
can be seen as a no go for many persons.

 FYI, complete API references now available on the site for JavaScript,
 CSS class names, and Java for app server integration.

Thank you, I'll try to have a look on it.

Eric

[1] Yes, this is on an intranet, so number of users is not very
impressive...

-- 
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: Introducing AutoTable, new Table/Grid widget

2010-08-12 Thread Eric
Hi Blaine,

And thanks for sharing this.

If I may make a couple of remarks for next version :
- for the columns sorting, use mouseup instead of mousedown: It
will react like other sortable controls, and this should allows you to
not sort the table when user want to drag the column.
- the nested rows feature is great but the visual feedback can be
confuse to average web user. Perhaps using little + and - like
tree node extension buttons (or whatever new thing is used in tree on
new OSes). Once the rows are visible, perhaps your Ext column could
contains a vertical line joining all expended rows (like Excel does).
- also it would be nice if while editing, the tab key could validate
the changes and open for editing the next column.

T.J.: What about adding a resource list to the unofficial wiki (iirc
there is one who list the resources websites, but perhaps a page where
contributors can list their add-ons, a quick resume and a link could
help).
,
Eric

On Aug 11, 3:17 pm, Blaine blaine.simp...@admc.com wrote:
 Thanks T.J.  I've used Scripteka before... that's where I've found
 most of the Prototype widgets that I use, but I didn't think it was
 updated, due to half of the site functions being broken (apprently due
 to the Trac library being broken).  But I stand corrected because I
 see some library listings from 2010.

 Now if I can just contact the Scripteka maintainers since the
 submittal system and even the bug report function aren't working.

 On Aug 11, 4:43 am, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

 http://scripteka.com/hasPrototype plug-ins and such.
  --
  T.J. Crowder
  Independent Software Consultant
  tj / crowder software / comwww.crowdersoftware.com
  ...
   I can't find anyplace on the PrototypeJS site to get any publicity.
   Anybody have any tips about that?



-- 
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: IE 8 Error: The data necessary to complete this operation is not yet available

2010-08-12 Thread Eric
I am kind of sure all browser has a size limit on GET method
parameters.
IE6 just happens to have the smaller one.

On a general way, there is very few advantage to use GET instead of
POST, so you should not use GET except in some very specific cases
like sending an username or a fixed size's session ID[1]

However, you should know that there is also a size limit in POST
parameters on the server side.
Default value for those is often around 8 or 16 MB (which should be
enough).
Note also that some server-side technologies (like PHP) have another
limit for the size of uploaded files.
This means that if this limit is 2MB, you will not be able to send a
3MB file in your form, even if you fixed the POST limit size to
8MB[2].

Eric

[1] I said it would work. Not that it would be safe to do it :o)
[2] I lost a lot of time on this one first time I met this issue...

On Aug 11, 3:47 am, KammylandSoftware kammyl...@gmail.com wrote:
 I found the solution, actually.

 As it happens IE 6 has a payload length limit when using the GET
 method. As it just so happens, I was in fact using the GET method to
 send some parameter data to the server in an ajax request (using
 prototype). Hence, the ajax request would not go through; then, when I
 assayed to access ajaxRequest.transport.responseText, I appeared to
 get the The data necessary to complete this operation is not yet
 available error, as it indeed was not available since the ajax
 request never went through; not withstanding I did send the Ajax
 request as asynchronous, it was thrown.

 The solution apparently was to use the POST method instead of GET, as
 IE 6 does not seem to have a similar limit on POST's payload as it
 does on GET's.

 Thanks anyhow fellows.

 On Aug 4, 1:12 pm, Eric lefauv...@gmail.com wrote:

  I think IE8 features a not that bad javascript debugger.
  If you activate it and reload your page, it will stop on the faulty
  line.

  On Jul 30, 10:45 pm, KammylandSoftware kammyl...@gmail.com wrote:

   Using the latest Prototype and Scriptaculous scripts hereto (July,
   2010) I am getting this error in IE 8:

   The data necessary to complete this operation is not yet available.

   As IE does not give us a script filename but only a all-scripts-
   aggregate line number where the error occured, I have no idea what
   could be causing this. I did a Google search, but the only reasonable
   hit I got does not seem to exists anymore.

   Regards.



-- 
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 on anchor onclick is buggy in Safari

2010-08-12 Thread Eric
T.J., I was surprised too that the DB would have time to get an update
before the page is unloaded, but I had a closer look at the
example :o)
If the links urls are downloadable file types like the .exe of the
example, the browser will not unload the current page, and the Ajax
request will complete.

Perhaps Safari does unload the page. You may try to specify a target
to the link to force safari to not replace the current page.

Also, I thought that the onclick handler should return a true value
for the link being followed...
Shouldn't you write something like  onclick = return
logClick()... and add a return true at the end of your function?
[1]

The unintrusive approach of Fabien is probably the best here too
(well, not as good as the server side one but if you don't control the
server side...).
However, instead of creating an event for each link, you may observe
the document and use the event bubbling.
It would look like this (untested):
document.observe(click, function(event){
  var link = event.findElement(a.log);
  if(link)
  {
new Ajax.Request('/logger.php?action=1');
  }
});

you may use the link variable to get the href value of the link and
send it to your ajax script.

Advantages are:
- Only one event listener (may cause a difference on IE's memory
leaks)
- It will work with dynamically added links

I removed Fabien's trick to wait the Ajax's return before changing the
location because I think the target attribute will fix the issue[2],
but feel free to use it if there is no other choice (safari users will
have a crappy experience, but it will work...).

Once again, try first to have a server side solution. It will work
better.

Eric

[1] Well, what you really should do is using observe :o)
[2] and like T.J. said, it will reduce user experience.

On Aug 11, 3:02 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 By default, Ajax.Request is *asynchronous*. I'm surprised, frankly,
 that you're seeing many database updates at all, regardless of the
 browser, since a request may not have been transmitted before the page
 gets torn down to make way for the new one. I wouldn't expect it to be
 reliable.

 If you made the requests synchronous, it would likely be fairly
 reliable, but the user experience would be seriously degraded -- the
 entire browser (in most cases) would appear to lock up for a second or
 two before the link was followed. And of course, if the user has
 JavaScript disabled, it's game over.

 As Fabien mentioned, the reliable way to do this is server-side with a
 redirect. His second suggestion (handling the click event, cancelling
 it, sending off an Ajax request, and then triggering the location when
 the request completes) will again result in a degraded user experience
 on multiple levels -- delays (though at least the browser wouldn't
 lock up), shift- and ctrl- click not handled correctly, etc.

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Aug 10, 11:34 pm, JoJo tokyot...@gmail.com wrote:

  I'm collecting stats on user clicking behavior. In this example, I
  write an entry into the database whenever someone clicks a link that
  starts a download:

  a href=program.exe onclick=logClick()download program/a

  function logClick() {
     new Ajax.Request(
        '/logger.php?action=1'
     );

  }

  This works great in Internet Explorer and Firefox. In Firefox, my
  Firebug highlights the request in red as if it's an error. Anyway, I
  see my database being updated, so I'm not too worried. What I'm
  worried about is this fails to work in Safari 4. The only way I can
  get it to work is:

  function logClick() {
     new Ajax.Request(
        '/logger.php?action=1', {
           onSuccess: function(transport) {
              alert(transport.responseText);
           }
        }
     );

  }

  For some reason, this causes the database to be written to.
  Transport.responseText is blank for unknown reasons. How do I get this
  to work without the alert? The alert degrades the user experience.



-- 
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: Preventing Autocompleter

2010-08-04 Thread Eric
Sorry for the late reply (Holidays :o) ) but why don't you just
disable the city field until the state field is filled?

On Jul 5, 9:19 pm, Jonathan Snelling jon.snell...@gmail.com wrote:
 There should be a before or a conditional parameter you can pass. That
 returns true to continue or false to not send the request.

 On Monday, July 5, 2010, infringer infrin...@gmail.com wrote:
  No takers?  I guess there is no way to do this?

  On Jul 1, 6:51 pm, infringer infrin...@gmail.com wrote:
  I have an autocompleter on a City field.  But I don't want it to send
  the request UNLESS the state field is filled in?

  Any suggestions on how to prevent it from sending the request?  No
  need for the unnecessary requests going back and forth.

  Thanks,
  -David

  --
  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] Re: window.open on ajax response

2010-08-04 Thread Eric
The browser probably blocks the popup because it is not opened by a
direct action of the user.

What you may try is:
- On the click event:
  - Open the window on a blanc (or temporary) url
  - Launch the Ajax request
- On the Ajax's onComplete:
  - Change the url of the previously opened window

Eric

On Jul 13, 11:15 am, ColinFine colin.f...@pace.com wrote:
 On Jul 12, 5:31 am, Hari hariharanwebm...@gmail.com wrote:

  But even this doesn't help since function call happens by a call back
  and not user action. So the browser popup blocker click in.
  One way i could think is make the Ajax call synchronous. But I think
  its not a great idea to make the Ajax call synchronous...

 I don't see how this would make any difference.

 What you have not made clear are what are the circumstances in which
 your browser blocks popups.
 Without knowing that it is hard to suggest a solution.

 It seems unlikely to me that it makes a difference whether the window
 is opened from a callback or not, but I don't know.

 Colin

-- 
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: Login-Function broke with Firefox 4.0b2

2010-08-04 Thread Eric
Are you sure your firebug is compatible with this FF version?
I experienced this kind of issues (js errors occurring without any
error message or exception) in the past due to conflict between new FF
and old Firebug.

I also noticed that for some reason when one exception is fired during
an Ajax call, Firebug sometime doesn't show anything.
For what it worth, did you try to put a breakpoint in Ajax.Request's
handler (the code that will actually call your callback)?

Eric

On Jul 28, 12:43 pm, Marcus Schwarz msspamf...@gmx.de wrote:
 Hi there,

 I'm using a login based on prototype's Ajax-functions on my website. It
 works perfectly with every up-to-date browser, but for the new Firefox
 4.0 Beta 2 it is broken.

 I'm doing the following:

 // several pre-checks
 if (ok) {
         new Ajax.Request('dispatcher.php', {method:'post', parameters: {mode:
 'login', server: $('l_server').value, login: $('l_loginname').value,
 pass: $('l_password').value, l_ref: $('l_ref').value}, onSuccess:
 _handleLoginSuccess, onFailure: _handleLoginFailure});

 }

 dispatcher.php contacts some server based on the users' choice,
 establishes a session and sends that session-cookie back to the browser,
 alongside with further information like a target url.  The json-result
 looks like:
 {error:false,target:url here,ident:4e932}
 The cookie is set correctly in the response-header.

 Now the onSuccess-handler should handle this result. But: nothing
 happens. The handler:

 function _handleLoginSuccess(e) {
         console.debug(e);
         e = e.responseJSON;
 [blahblahblah]

 }

 There is no console output, there is nothing of the payload executed. If
 I set a breakpoint inside the handler, it is never reached. The
 failure-handler isn't called either.

 Now I'm stuck. Anyone having a great idea how to track down that
 problem? I'm using prototypes last stable release 1.6.1

 Thank you in advance

 Marcus

-- 
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: Touch screen / mouse gesturing.

2010-08-04 Thread Eric
About ideas/suggestions, instead of using text input for entering car
and personal pin numbers, have you considered using bar codes?
It is surprisingly easy to add barcode reading from a website using
ZXing (http://code.google.com/p/zxing).

In big lines, you have to install the free scanner on the phone
(available on iPhone, android and some others), and then the phone's
web browser can understand specially formated urls (see doc for
details) that will when navigated to (i.e when user press a button) :
- Start the scanner
- Navigate to one of your url with the scanned barcode value as GET
parameter

I would be surprised that any company owning a fleet of vehicles
nowadays would not having already sticked on them some barcode ID for
maintainability purpose.

FWIW, that would be a killer app to use (press one button, point
phone's camera to car's code until it beeps, point phone's camera to
your id badge until it beeps, and press a confirmation button) :o)

Eric

PS: Of course, don't remove the text input for peoples using an
iPad ;o)
On Jul 29, 1:41 pm, Richard Quadling rquadl...@gmail.com wrote:
 Hi.

 I'm developing a tiny little web page app which allows vehicle
 inspectors to see the work last carried out on a vehicle.

 The display shows the order header (who, when) and the order details (what).

 At the bottom of the display, there are 3 buttons - Prev, New Search, Next.

 The display is fed using AJAX, so no screen redraws and is very responsive.

 Along with the Prev and Next buttons, a user can press 'P' or 'N'.

 The app only has 2 input boxes and a button on the first page
 (vehicle number and personal pin number for the inspector which is
 linked to the contract(s) which are linked to the vehicle).

 The main display has the 3 buttons described above and there is an
 error notification page (vehicle not found, invalid pin number,
 etc.). This page has the New Search button.

 All working great on a desktop (IE8, Chrome and FireFox).

 The app is going to be mainly used via a browser on a mobile internet
 device (could be an iPhone, an iPad, or anything that has a browser).

 For the touch screen systems, I'd like to be able to implement some
 touch screen support.

 I'd like to implement something where if the user wipes their finger
 from left to right (like turning a page), then they are choosing
 Previous. If they wipe right to left, then are choosing Next.

 Are there any standards for this (OK, I'm just being hopefully) ?

 Can I simulate this using Prototype?

 At a guess, I think the following steps are needed ...

 1 - On mousedown, record position and time.
 2 - On mouseup, determine direction and duration.
 3 - For a short duration and a fairly low difference in the vertical
 movement, assume the intent is to trigger the page turning
 4 - For a long duration or a big difference in the vertical movement,
 do nothing extra.

 Assuming something like the above is right, how does
 highlight/cut/paste mechanism work?

 For this app, the content is pretty generic and no real need for cut and 
 paste.

 Any ideas/suggestions/etc. would be gratefully received.

 Regards,

 Richard Quadling.

-- 
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: IE 8 Error: The data necessary to complete this operation is not yet available

2010-08-04 Thread Eric
I think IE8 features a not that bad javascript debugger.
If you activate it and reload your page, it will stop on the faulty
line.


On Jul 30, 10:45 pm, KammylandSoftware kammyl...@gmail.com wrote:
 Using the latest Prototype and Scriptaculous scripts hereto (July,
 2010) I am getting this error in IE 8:

 The data necessary to complete this operation is not yet available.

 As IE does not give us a script filename but only a all-scripts-
 aggregate line number where the error occured, I have no idea what
 could be causing this. I did a Google search, but the only reasonable
 hit I got does not seem to exists anymore.

 Regards.

-- 
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: $$()

2010-08-04 Thread Eric

On Jul 30, 1:26 pm, Richard Quadling rquadl...@gmail.com wrote:
 $('form_id').observe('blur', function(ev) {
  var el = ev.findElement('input[type=text]');
  if (el) {
   // el is the element that triggered the blur.
 .../...
 [1]http://api.prototypejs.org/dom/event/findelement/

According to the provided link, If no matching element is found, the
document itself (HTMLDocument node) is returned..

Is it a bug in the documentation?
Until now, I've been paranoid testing (el  el != document) but I
have a feeling that your test works as we think it should (returning
null or undefined when no matching element is found).

Any enlightenment on this topic is welcome :o)

Eric

-- 
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: Issues with IE8, mousedown, mouseup -

2010-06-25 Thread Eric
Returning false is not enough with prototype.
You have to call the stop() method.

This should look like this (untested):
$('yourButtonId').observe('mouseup',function(event) {
  event.stop();
});

If you put everything in mouseup event, just call event.stop() at the
end (this should prevent other mouseup handlers to be called).

Eric

NB: Sorry I mismatched two languages: ihm is French accronym for
GUI (Graphic User Interface).
What I meant to say is that if you press any of your operating
system's button, the action will not be performed until you release
the mouse button.

On Jun 24, 6:47 pm, max radin max.tomlin...@gmail.com wrote:
 I have tried that - same behavior - after the widget renders the
 results, the form/page (or whatever is happening) is reset.
 I've also tried trapping the mouseup and having it a) return false b)
 do nothing (after the mousedown has processed the search) - all to no
 avail: form is reset.
 The only thing that seems to work is if I put an alert in the mouseup
 and don't repsond to it until well after my search results are posted.
 So I need a way of no-opping the mouseup event.
 Any ideas anyone?
 what is 'ihm' BTW?
 thanks
 Max

 On Jun 24, 2:17 am, Eric lefauv...@gmail.com wrote:

  Hi,

  Have you consider using mouseup instead of mousedown?
  This is indeed how standard ihm buttons works.
  It doesn't explain or justify IE8's behavior, but if it works, you can
  hit two birds with one stone.

  Eric

  On Jun 24, 1:55 am, max radin max.tomlin...@gmail.com wrote:

   Hi-

   I have a search widget class written in prototype that's been running
   fine for a couple of years now in FF and IE6+7. The user enters search
   parms, clicks a button and an ajax interaction (using jboss seam)
   retrieves data from a host server class (Java). The results are
   populated into a div and rendered using Element.show. The search
   widget is flexible enough to be used in multiple pages. The button
   event fired is onmousedown.

   The problem I am having with IE8 is that the mouseup event is being
   invoke and reloading the form (which contains the search widget). If I
   keep the button pressed down, the results display fine. Once I let the
   button go (mouseup) my form is reloaded. I've tried intercepting the
   mouseup event but it only nullifies the mousedown. I'm using the
   latest prototype.js (1.7x and have tried multiple versions).

   Any ideas?

   many thanks
   Max



-- 
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: Issues with IE8, mousedown, mouseup -

2010-06-24 Thread Eric
Hi,

Have you consider using mouseup instead of mousedown?
This is indeed how standard ihm buttons works.
It doesn't explain or justify IE8's behavior, but if it works, you can
hit two birds with one stone.

Eric

On Jun 24, 1:55 am, max radin max.tomlin...@gmail.com wrote:
 Hi-

 I have a search widget class written in prototype that's been running
 fine for a couple of years now in FF and IE6+7. The user enters search
 parms, clicks a button and an ajax interaction (using jboss seam)
 retrieves data from a host server class (Java). The results are
 populated into a div and rendered using Element.show. The search
 widget is flexible enough to be used in multiple pages. The button
 event fired is onmousedown.

 The problem I am having with IE8 is that the mouseup event is being
 invoke and reloading the form (which contains the search widget). If I
 keep the button pressed down, the results display fine. Once I let the
 button go (mouseup) my form is reloaded. I've tried intercepting the
 mouseup event but it only nullifies the mousedown. I'm using the
 latest prototype.js (1.7x and have tried multiple versions).

 Any ideas?

 many thanks
 Max

-- 
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: Proper error handling

2010-06-23 Thread Eric
I also have a similar method, but I use an Ajax responders to check
the error flag and divert the processing to an alternative function
when it is set.
Since there is no Ajax.Responder for onSuccess, I use onCreate to wrap
the error management code around the provided onSuccess option.

I once considered returning a custom HTTP status code and using either
onError or on5xx (where 5xx is the custom status code for my errors).
I am curious if someone tried this, to know if it was a good choice or
not.

Eric

On Jun 23, 4:24 am, joe t. thooke...@gmail.com wrote:
 Oh thank god. i thought i was being incredibly dense using a solution
 like that. But having seen no other way to determine the procedural
 path to take when the server responds (barring a transport error),
 that seems the most effective way to follow one route for successes
 and another for failures/errors. Would be interested in seeing some
 tips for that wrapper magic. ;)
 -joe t.

 On Jun 22, 2:45 am, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  On Jun 21, 9:58 pm, Jason 'XenoPhage' Frisvoldxenoph...@godshell.com 
  wrote:

  [snip]

   What about a non-HTTP error?  What if, for
   instance, myId was invalid?  What is the proper way to pass that
   information back to the ajax application?  Is it ok to use a custom 4xx
   error?  Or should I be using JSON or XML to handle this?

  The answer is in the question. :-) If it's a non-HTTP error, it
  wouldn't be best practice to use an HTTP error code to represent the
  error. (Not that HTTP status codes don't have a fair bit of scope
  creep in them already.)

  I've standardized by having *all* of my Ajax calls return data in the
  same way. They all return JSON-formatted data, and the format for
  success is always:

      {
          success: true,
          otherdata: here
      }

  and the format for errors is always:

      {
          success: false,
          errMessage: error message here
      }

  In any given application, I tend to have a  wrapper around Prototype's
  ajax stuff with some problem-domain logic in it. That wrapper always
  checks for the `success` flag on calls and routes to the error handler
  if it's not there.

  FWIW,
  --
  T.J. Crowder
  Independent Software Consultant
  tj / crowder software / comwww.crowdersoftware.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-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: drag and drop on the iphone

2010-06-01 Thread Eric
Hi,

iPhone and friends use dedicated event like touchstart, touchend,
touchmove and touchcancel (those 4 ones seems to do what you're
looking for and seems to be supported by both iPhone and Androids
phones (with the stock browser)).

You may find an exhaustive(?) list of event supported by your browser
by opening this page:
http://yura.thinkweb2.com/isEventSupported/

HTH,
Eric

Note: You may have to implement your own drag'n drop framework using
those messages since I have no idea if scriptaculous one support them
(probably not or you wouldn't have asked :o) ).

On May 30, 5:14 am, Shank Bogey mgost...@gmail.com wrote:
 I have an online chess site that uses scriptaculous for drag and drop
 (crazylogic.net/chess).  I would love if the chess board (drag and
 drop) worked on the iPhone, is this possible?

 Touch and drop would be great...

 I've been seaching google for the last hour and haven't gotten very
 far.  I would very much appreciate some guidance.

 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-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: Applying .appear() effect on a background

2010-05-25 Thread Eric
Hi

On May 23, 4:51 pm, Darkie masia...@gmail.com wrote:
 Hey,
 I'm trying to change the background of a page using setTimeout and
 some function. It works but it's ugly to see. Is it possible to apply
 the .appear() function in a way that the background changes with that
 effect?

AFAIK, there is no way to do that, but if instead of using the body's
background style you insert a low z-order div under your page and use
its background style, you may use appear effect on it.

Basic step would be:
- having a -1000 z-order div with background set as original
background.
- creating a new div with -999 z-order, fully transparent with your
new background
- use appear effect on this new div
- after the effect is completed, remove the initial div, and change
the new div's z-order to -1000 so you are ready to change the
background again (you may want to change its id to the original div's
id).

Good luck.
Eric

 Thanks

 M

 --
 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] Re: Cross-browser function for Text content

2010-04-13 Thread Eric
What I use in this case is:
$('test').textContent || $('test').innerText

If textContent is defined, it is used. if it isn't, innerText is used.
This would be a lot faster than stripping tags.
The only drawback I can think of is that sometime you may get an
undefined instead of an empty string (which would be equivalent to
false).

Eric

On Apr 12, 9:35 pm, Rüdiger Plantiko ruediger.plant...@astrotexte.ch
wrote:
 Hi TJ,

   I get the number 4711 in IE with $(test).innerText and in FF with $
   (test).textContent - does Prototype provide a browser-independent
   abstraction for this?

  Hopefully you get the *string* 4711 rather than the number 4711
  (unless you parse it). :-)

 You are right, in a posting every word is important, in order
 to avoid misunderstandings. So, yes: I am getting the string, not the
 number.

  ... innerHTML ...

 yeah, if the document structure guarantees to me that the element in
 question only contains a text node, then I could use innerHTML
 equivalently
 to innerText/textContent.

  Element.addMethods({
      text: function(element) {
          if (!(element = $(element))) return;
          return element.innerHTML.stripTags();
      }

  });

 thanks for the reference to String.stripTags() - I hadn't realized the
 existence of
 such a function before.

 - Regards,
 Rüdiger

-- 
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: Cross-browser function for Text content

2010-04-13 Thread Eric


On Apr 12, 7:04 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Element.addMethods({
     text: function(element) {
         if (!(element = $(element))) return;
         return element.innerHTML.stripTags();
     }

 });

wouldn't it be wiser to check for the native method once and use it?

Something like (untested)

Element.addMethods({
text: function(element) {
if (!(element = $(element))) return;
return element.innerHTML.stripTags();
}


if($$('BODY').first().textContent===undefined)
{

}

-- 
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: Cross-browser function for Text content

2010-04-13 Thread Eric
Oooops, gmail sent the message before I finished... :o)

Here is the correct message (please ignore the previous one)

On Apr 12, 7:04 pm, T.J. Crowder t...@crowdersoftware.com wrote:

 Element.addMethods({
     text: function(element) {
         if (!(element = $(element))) return;
         return element.innerHTML.stripTags();
     }

 });

wouldn't it be wiser to check for the native method once and use it?

Something like (untested)

Element.addMethods({
    text: ($$('BODY').first().textContent===undefined)
? function(element) { if (!(element = $(element))) return;
return element.innerText; }
: function(element) { if (!(element = $(element))) return;
return element.textContent; }
});

Eric

NB: I know, the testing condition is ugly... feel free to post a
better one :o)

-- 
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: The Unofficial Wiki

2010-04-12 Thread Eric
Hi,

Instead of moving the wiki content to official prototype's page,
couldn't we just rename it as Official Wiki and link it from the
prototypejs homepage?
This would allows more peoples to find the content while still let
them add/edit content if they wish it.

The howtos (and some of the tips) are a real added value and are not
available anywhere (afaik).

Of course, since the wiki is also about scriptaculous we may have to
find a clear way to not confuse users which just need prototype
information.

Eric

On Apr 9, 12:43 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

  I think the site needs an integrated contribution system for Prototype
  Extensions, better than jQuery's(http://plugins.jquery.com/).

 One thing at a time. :-) And of course, there's scripteka.com.

  Some want something easier than learning git,
  rake, lighthouse, etc.,  in order to contribute; maybe a web front-end
  to whichever code is in place, to lower the barrier to contributing.

 Good news: Apparently in GitHub, you can fork the project and do on-
 site editing of content (Mislav and Tobie just told me about that),
 then send a pull request. So if git is a barrier, someone can
 contribute just using a browser. Result!

 -- T.J. :-)

 On Apr 9, 3:17 am, disccomp discc...@gmail.com wrote:

   T.J. Crowder:

   Question:

   Do we need a wiki with user-generated content?

    We should:

   just move all of the relevant content to the Prototype website and make 
   sure the
   process for contributing to the website is well-publicized, easy, and
   efficient

  I think the site needs an integrated contribution system for Prototype
  Extensions, better than jQuery's(http://plugins.jquery.com/). It would
  be great if the extensions and the patch submission system shared a
  contribution system. Some want something easier than learning git,
  rake, lighthouse, etc.,  in order to contribute; maybe a web front-end
  to whichever code is in place, to lower the barrier to contributing.
  User generated code and examples could be posted  maintained right on
  the site with (Prototype Friendly) syntax highlighting.

  Rico 2.0  has lots of goodies[1], so does Scriptaculous, it would be
  awesome to sync all these projects up, make the components modular
  with clear a dependance scheme, especially when considering the future
  of the library.

  [1]http://openrico.sourceforge.net/examples/index.html



-- 
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: Class Inheritance from Element

2010-04-12 Thread Eric
Could you post a use example?

In this case, I usualy create a simple class not derived from Element
and a maker function to extend DOM elements with this class
prototype.
I am not sure at all it is the best approach but it works and is
relatively easy to maintain.
It looks like this (untested) for exemple if you want to cast a LI tag
into a kind of tree:

function mkTree(domElement) {
  domElement = $(domElement) || new Element('li');
  Object.extend(domElement,Tree.prototype);
  domElement.initialize();
  return domElement;
}

var Tree = Class.create({
  initialize: function() {this.addClassName('tree'); },
  createNode: function(...) {.../... }
});

You may have to play with Array.shift and Function.call if you want to
have extra parameters to your constructor (I've never needed it yet
but it should be possible).

Eric

Note: I've never tried to override a native method and I am kind of
certain it would not work :o)


On Apr 7, 9:11 pm, Guss gus...@gmail.com wrote:
 On Mar 25, 12:02 am, Glen a...@usa.com wrote:

  I would like to use Prototype's class inheritance to derive a class
  from Element as below:
  The current structure of Element and Class does not support such.
  I was wondering if anyone had anything more elegant.

 I have the same issue - I want to create my own classes that inherit
 from standard DOM elements, so I can do something like:
 var Button = Class.create(Element, {
   initialize: function($super, content) {
     $super('button');
     this.update(content);
   }});

 document.body.appendChild(new Button(submit));

 But as you noted, Element in prototype is not a prototype Class that
 can be extended using Class.create. I decided not to muck about with
 that and instead write something else. So I create
 Class.createElement() that works like as you would expect, with the
 very serious caveat that you can't override most native methods (not
 sure why - I can override some, but not others).

 The implementation looks like this (and is mostly copied from
 Class.create):

 Class.createElement = function(tagname, impl) {
         var IS_DONTENUM_BUGGY = (function() {
                 for ( var p in { toString : 1 }) {
                         // check actual property name, so that it works with 
 augmented
                         // Object.prototype
                         if (p === 'toString')
                                 return false;
                 }
                 return true;
         })();

         return function() {
                 var elm = new Element(tagname);
                 properties = Object.keys(impl);

                 // IE6 doesn't enumerate `toString` and `valueOf` (among 
 other built-
 in
                 // `Object.prototype`) properties,
                 // Force copy if they're not Object.prototype ones.
                 // Do not copy other Object.prototype.* for performance 
 reasons
                 if (IS_DONTENUM_BUGGY) {
                         if (impl.toString != Object.prototype.toString)
                                 properties.push(toString);
                         if (impl.valueOf != Object.prototype.valueOf)
                                 properties.push(valueOf);
                 }

                 for ( var i = 0, length = properties.length; i  length; i++) 
 {
                         var property = properties[i], value = impl[property];
                         if (Object.isFunction(value)  
 value.argumentNames()[0] ==
 $super) {
                                 var method = value;
                                 value = (function(m) {
                                         return function() {
                                                 return elm[m].apply(this, 
 arguments);
                                         };
                                 })(property).wrap(method);

                                 value.valueOf = method.valueOf.bind(method);
                                 value.toString = method.toString.bind(method);
                         }
                         impl[property] = value;
                 }
                 Object.extend(elm,impl);
                 elm.initialize.apply(elm,arguments);
                 return elm;
         };

 };



-- 
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: -[Accordion]-...

2010-03-31 Thread Eric


On Mar 29, 8:51 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 By the way, has anybody seen the new jsBin?! Really nice, and no more  
 halloween color scheme either.

Yes, it is a lot nicer, but it still is bogus on Firefox when using
scriptaculous:
You cannot use preview tab because it doesn't load scripts in the
correct order (scriptaculous is loaded before prototype.js which screw
things up).

I hope this will be fixed soon.

Eric

-- 
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: hash:zero

2010-03-31 Thread Eric
Something like that should do it:
yourHash = $H();

You're affecting a new empty hash to your old hash, which should be
garbage collected by the browser.

Eric

On Mar 29, 8:47 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 So if you had a hash of N length and you wanted to end up with a hash  
 with no members? You could try setting its length to 0. Not sure if  
 that works, but it would be the first thing I would try.

 Walter

 On Mar 29, 2010, at 2:26 PM, chrysanthe m wrote:

  Hello
  I am sure this is documented somewhere, I have googled and looked at  
  the api
  however it is still unclear.  How can I zero our all the keys/values  
  of a
  prototype hash without iterating over it?  Sorry if it is  
  documented, I
  couldn't find an api faq.  tia.

  --
  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-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 onFailure never gets called

2010-03-11 Thread Eric Wilson
does oncomplete fire?

On Mar 10, 4:31 pm, JoJo tokyot...@gmail.com wrote:
 I noticed that the onFailure callback never fires when there's
 actually an error in Ajax.Request. Commonly, I just alert('server
 busy') in the callback. I never see this alert when my web host is
 overloaded and just doesn't respond at all. How do I alert an error
 message when the server is too slow and never responds?

-- 
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: mutile-toggle problem

2010-03-10 Thread Eric Wilson
Surely has something to do with trying to toggle an item when it is
already in the middle if a toggle transition.  You might be able to
bail out and start rendering the reverse of the current toggle
animation by usingone of the callbacks and starting your new render at
the complement of whatever point the current render bailed out at:

http://wiki.github.com/madrobby/scriptaculous/core-effects

On Mar 10, 4:19 am, mikaeru mika...@gmail.com wrote:
 Hello there, I tried to implement two toggle buttom stay next to each
 other.
 if any buttom is toggled then it should be toggled back automatically
 while click on the other one.

 The codes below actually do the work, however, if somebody clicks on
 both buttoms in a second.
 it mess up the code as well as its behavior.
 I'm rather new to the prototype, so the code might look a little bit
 exhuasted.

 any suggestion and help?

 var isRightToggled = 0;
 var isLeftToggled = 0;
 contentToggleLeft = function() {
                 if(isLeftToggled) {
                         isLeftToggled = 0;
                 }
                 else {
                         isLeftToggled = 1;
                 }
                 if(isRightToggled) {
                         isRightToggled = 0;
                         new Effect.toggle('content-left', 'slide');
                         setTimeout(Effect.toggle('content-right', 
 'slide');, 1000);
                 }
                 else {
                         new Effect.toggle('content-right', 'slide');
                 }

 }

 contentToggleRight = function() {
                 if(isRightToggled) {
                         isRightToggled = 0;
                 }
                 else {
                         isRightToggled = 1;
                 }
                 if(isLeftToggled) {
                         isLeftToggled = 0;
                         new Effect.toggle('content-right', 'slide');
                         setTimeout(Effect.toggle('content-left', 'slide');, 
 1000);
                 }
                 else {
                         new Effect.toggle('content-left', 'slide');
                 }

 }

-- 
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: Disabling ajax.autocompleter (new way) when updating field

2010-03-05 Thread Eric
Just give the focus to something else.

Eric

On Feb 24, 11:02 pm, Jinsa jf.wesq...@gmail.com wrote:
 Hi all!

 Sorry for digging up such an old thread (see Disabling Scriptaculous
 autocomplete at the bottom of my thread)  but I'm working on the same
 problem (more or less).

 I have an input field using autocompleter and I must disable it when I
 modify the div wich contains the input field (it deletes the input and
 cause an error because the oberver on the autocompleter observe
 nothing)

 So, one solution seems to focus out the input field (doing manualy it
 dodge the error), it makes it stop the observer (wich is good! :))
 but... mmhhh... I don't even know how to focus out an input field ^^.
 I tried element.toogle, element.focus(0), element.hide()... nothing
 works.

 So, maybe someone have a clue in order to make it work (btw I may not
 want to modify controls.js... because I don't see how to disable it
 with the modifications)

 Enjoy your night!

 Jinsa.

 Original 
 thread:http://groups.google.com/group/prototype-scriptaculous/browse_thread/...

-- 
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: Having Effect.Opacity work with a Class and not an ID

2010-03-05 Thread Eric
Hi,

David from the list wrote a class for doing this (an effect that
actually modify the CSS style's style and by side effect all DOM
objects belonging to the same class:
http://scripteka.com/script/effect-onclass

Note that you'll need to be sure that your CSS style has an explicit
opacity value before calling the effect.

Eric

On Mar 5, 9:44 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You can use Effect.multiple[1] to apply the same effect to multiple
 elements. So:

     Effect.multiple($$('.fade-in'), Effect.Opacity, { from: 0, to: 1,
 duration: 1.5 });

 [1]http://wiki.github.com/madrobby/scriptaculous/effect-multiple

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Mar 3, 5:27 pm, CaptainNoob jacobl...@gmail.com wrote:

  ul id=menu
          li id=nav_home class=fade-ina href=/Home/a/li
          li id=nav_archivesa href=/archivesArchives/a/li
          li id=nav_contact class=fade-ina href=/contactContact Me/
  a/li
          li id=nav_googlea href=http://google.com;
  rel=externalGoogle/a/li
  /ul

  --

  new Effect.Opacity('fade-in', { from: 0, to: 1, duration: 1.5 });

  Is it possible to fire scriptaculous effects with a class name rather
  than an ID? I tried putting $$('fade-in') , but that did not seem to
  work.

  Thank you for the help.
  Jacob



-- 
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.Autocompleter doesnt work on firefox

2010-03-05 Thread Eric
Do you have any error/warning message in the Firefox console ?
If you're using Firebug's debuger, I've noticed that it sometimes just
stop code execution when reaching a line that will fail.
To see the error, you may go on script tab and click on Continue
execution (the VCR Play button like icon).

On Mar 4, 2:21 pm, Virginia virginianbar...@gmail.com wrote:
 I have a jsp where i include this:

 script src=js/scriptaculous/prototype.js type=text/javascript/
 script
 script src=js/scriptaculous/effects.js type=text/javascript/
 script
 script src=js/scriptaculous/controls.js type=text/javascript/
 script

 then i use it like this:

 input name=apellido  autocomplete='off' id=apellidoId size=40
 type=text value= /
 div class=autoComplete id=apellidoIdAutoComplete/div
  script type=text/javascript
              new Ajax.Autocompleter('apellidoId',
 'apellidoIdAutoComplete', autoComplete.do?tipoComplete=apellido,
 {paramName: valor, minChars: 3})
 /script

 then i have a class which loads de collectiion (colAutoComplete ... it
 loads the collection correctly) an then goes to a jsp that looks like
 this:

 ul
         logic:iterate id=elemento name=colAutoComplete
 indexId=indice
                 libean:write name=elemento //li
         /logic:iterate
 /ul

 any idea? thanks!

 On Mar 4, 9:51 am, green greenlaw...@gmail.com wrote:

  I have used that control before, never found it not work in firefox. what's
  ur code exactly?

  On Thu, Mar 4, 2010 at 3:54 AM, Virginia virginianbar...@gmail.com wrote:
   hi all,
   I'm having a problem with autocomplete on firefox,
   I'm using Ajax.Autocompleter and it works fine on IE but it doesn't
   show anything on firefox (3.6)
   Does anyone know which could be the problem? I'm using last
   scriptaculous version.

   Thanks a lot!

   --
   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.comprototype-scriptaculou­s%2bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/prototype-scriptaculous?hl=en.-Hide quoted 
  text -

  - Show quoted text -



-- 
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: change frequency in running periodical executer?

2010-03-04 Thread Eric
Didn't you mean :
 this.frequency = frequency;

:o)

Thanks for the snippet!

Eric

On Feb 21, 8:14 am, Радослав Станков rstan...@gmail.com wrote:
 There isn't PeriodicalExecuter#start method its
 PeriodicalExecuter#registerCallback

 You can do:

 code
 x.stop();
 x.frequency = 1;
 x.registerCallback();
 /code

 You can also do:

 code
 PeriodicalExecuter.addMethods({
   changeFrequency: function(frequency){
     this.stop();
     this.frequency = 1;
     this.registerCallback();
   }});

 /code

 an then just call:

 code
 x.changeFrequency(1);
 x.changeFrequency(whatever);
 /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-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: callback decoration

2009-12-17 Thread Eric
Hi Sergio,

I am not sure what you mean by make the bind but here is an example
doing what you ask using ajax responders:

Ajax.Responders.register({
  onCreate: function(ar)
  {
ar.options.onSuccess = ar.options.onSuccess ||
Prototype.emptyFunction;

ar.options.onSuccess = ar.options.onSuccess.wrap(function
(localCB,xhr,xjs)
{
  // Do your stuffs here
  alert(Apex inboud!);

  // Then call the provided callback
  localCB(xhr,xjs);
});
  }
});

new Ajax.Request('http://jsbin.com/azeyo',{
  onSuccess: function(xr) { alert(CB:+xr.responseText); }
});


You can see it working here: http://jsbin.com/afudi and play with the
code here: http://jsbin.com/afudi/edit

Eric

--

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] background-color stucked after an highlight effect

2009-12-04 Thread Eric
Hi,

I have a table with even rows having an even class name.
even changes the background color of the row:

tr.even { background-color: #def; }

My concern is that after using a Effect.Highligth on some rows, if I
add or remove the even className to them, their background color
doesn't change anymore.

I tried without success those 3 approaches:

new Effect.Highlight(tr,{queue: 'end', afterFinish:
   function() { tr.style.backgroundColor = undefined;}});

new Effect.Highlight(tr,{queue: 'end', afterFinish:
   function() { tr.setStyle({'background-color: 'none'});}});

new Effect.Highlight(tr,{queue: 'end', afterFinish:
   function() { tr.setStyle({'background-color': 'inherit'});}});

Can anyone tell me what I am doing wrong?

Eric

--

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: background-color stucked after an highlight effect

2009-12-04 Thread Eric
Thanks David,

It does work!

And do does tr.style.backgroundColor = '';

Why did I look for something complex when solution was so simple :o)

Thanks again!

Eric

On Dec 4, 1:08 pm, david david.brill...@gmail.com wrote:
 Hi Eric,

 do you try to reset the element style property for background-color ??
 try this
 new Effect.Highlight('b',{queue: 'end', afterFinish:
    function() { $('b').setStyle({backgroundColor:''});}});

 --
 david

 On 4 déc, 12:55, Eric lefauv...@gmail.com wrote:

  Hi,

  I have a table with even rows having an even class name.
  even changes the background color of the row:

  tr.even { background-color: #def; }

  My concern is that after using a Effect.Highligth on some rows, if I
  add or remove the even className to them, their background color
  doesn't change anymore.

  I tried without success those 3 approaches:

  new Effect.Highlight(tr,{queue: 'end', afterFinish:
     function() { tr.style.backgroundColor = undefined;}});

  new Effect.Highlight(tr,{queue: 'end', afterFinish:
     function() { tr.setStyle({'background-color: 'none'});}});

  new Effect.Highlight(tr,{queue: 'end', afterFinish:
     function() { tr.setStyle({'background-color': 'inherit'});}});

  Can anyone tell me what I am doing wrong?

  Eric



--

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: this and setTimeout in Prototype-based class

2009-12-04 Thread Eric
Well, since you're in Prototype, you can do this:

this.doSomething.bind(this).delay(1000, ...);

where the ... stand for other parameters of doSomething method (if
they are needed).

Eric


On Dec 3, 3:29 pm, Daan Mortier daanmort...@gmail.com wrote:
 I'm sorry, I made some typos. This is correct:

 // where obj is obviously your object
 var func = function() {
    this.doSomething()}.bind( obj );

 window.setTimeout( func, 1000 );

 Daan

 On Thu, Dec 3, 2009 at 15:28, Daan Mortier daanmort...@gmail.com wrote:
  To pass a function to setTimeout that is binded to an object of choice, to
  something along these lines:

  // where obj is obviously your object
  var func = function() {
     this.doSomething()
  }.bind( this );
  window.setTimeout( func, 1000 );

  Function.prototype.bind is a function that's defined in the Prototype
  library. Hope this helps.

  Daan

  On Wed, Dec 2, 2009 at 15:25, fma f...@gbiloba.org wrote:

   Hi,

  I'm new to Prototype. I'm using it to write a little application for
  our photoclub. Its goal is to allow users to upload photos, and then
  vote for them.

  I display all the thumbs, and a double-click on a thumb opens the
  photo in full-screen (in a div). As the photo can take time to load, I
  use setTimeout() to delay the display. The code looks like:

  But it does not work. In the _show() method, the call to
  this._flashNavButtons() leads to an error (this._flashNavButtons() is
  not a function). I think I understand why: when called from the
  timeout mecanism, 'this' no longer exists, or does not point anymore
  on my object...

  Is there a way to pass 'this' in the timeout callback? I also use such
  timeout callback to make the navgation buttons blink 3 times when the
  photo is opened in full size…



--

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: document.write() vs Element/appendChild()

2009-12-04 Thread Eric
When you have a large piece of code to post, it is nice to also post a
link on
pastie.org or jsbin.com.

For example, I pasted the code you've posted on pastie here:

http://pastie.org/727583

Eric

On Dec 4, 8:09 am, fma f...@gbiloba.org wrote:
 BTW, what is the tag to format code on this group?

--

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: Sychronize many asynchronous Ajax.Request

2009-11-27 Thread Eric
And next, because an array is much more flexible than variables. you

I am sorry David, but I don't agree with you on this :o)

An object variable is ways more flexible than an array. Especially if
you add some methods to its prototype to fit your needs.

And it is probably overkill in this case, where an incremented int
would do it unless you actually need the result objects of every
previous requests (which is not the same thing than need to be
executed after every previous requests which is the need expressed by
maalek).

Alex: That's weird, but I was thinking the xhr object was stored in
the closure of the Ajax.Request object, and garbage collected after
the last callback was called (unless you store a reference to this
object in another variable of course).
It seems I am obviously wrong here I guess I'll have to have a
look in the source again :o)

var request=new Ajax.Periodical...({});

request=null;

If you nullify the Periodical thingy, will it continue to be called?

--

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: Sychronize many asynchronous Ajax.Request

2009-11-23 Thread Eric
Hi,

I'd launch all Ajax.Request except the last one with a onSuccess
handler that:
- set a flag
- if all flags are set, launch the last Ajax.Request

This way, you don't have to use timer, or loop calling yourself
recursively.

Eric

NB: I didn't test it, but you may increment a counter instead of using
many flags



On 21 nov, 23:31, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

  Synchronous is simple way but object create time increses x3. How
  function use to wait until all object is ready ? setInterval ?

 Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
 Function#defer / Function#delay. Have the code in question check its
 preconditions, and if they're not met, setTimeout/defer/delay itself.
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Nov 21, 2:33 pm, maalek maaa...@gmail.com wrote:

  Synchronous is simple way but object create time increses x3. How
  function use to wait until all object is ready ? setInterval ?

  maaalek

  On 21 Lis, 14:32, Alex McAuley webmas...@thecarmarketplace.com
  wrote:

   Ask it to check a variable that is set as ready by all the others .. or 
   make
   it defer and be synchronous ..

   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: maalek maaa...@gmail.com
   To: Prototype  script.aculo.us 
   prototype-scriptaculous@googlegroups.com
   Sent: Saturday, November 21, 2009 12:59 PM
   Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request

Hello

I have problem. When my page is load I build many objects (aprox 15)
by Ajax.Request (asynchronous : true) but last object I can create
when all previous object is ready. Any idea how do that ?

maaalek

--

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=.

--

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=.




[Proto-Scripty] Re: onClick vs Element.observe

2009-11-18 Thread Eric
Hi,

I also think delegation is the better approach.
However, I did notice that none of the examples was dealing with the
case where the user click on something that is not a '.item'.

You may want to do something like this:

function doIt(e) {
  var element = e.findElement('.item');
  if(element != document)
  {
var id = element.id;
// Do your stuffs here
  }
}

Eric

On Nov 18, 1:47 pm, ColinFine colin.f...@pace.com wrote:
 On Nov 17, 10:17 pm, phegaro pheg...@gmail.com wrote:



  Delegation sounds like a good model for doing this although if i want
  to pass parameters that are custom to each node like which id did it
  click on then i assume i have store it as a property on the node and
  pass arguments to the delgated function?

  In the above example if doIt took a paramter of the id to work on,

  doIt(id)  {
  // do something to the object with id X
  ...

  }

  Then with the delegation model i would have to retreive the node using
  findelement and then have an attribute on the node that held the id?
  Is that right?

 Yes, clearly; if the processing is different for different element
 then a delegation model requires you to determine which element you
 are processing and choose your processing accordingly.

 If each item is distinct, give them all an HTML 'id', and just use
 that:

 function doIt(e) {
 var element = e.findElement('.item');
  var id = element.id;

 If there are classes of them, it's easiest to use CSS classes:

 span class='item click_class_1' ...

 function doIt(e) {
  var element = e.findElement('.item');
  var class_1 = element.hasClassName('click_class_1');

 or more generally

 function doIt(e) {
   var element = e.findElement('.item');
   if (var matches = element.className.match(/click_class_(\n+)/) {
     var clickclass = matches[1]);

--

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.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




[Proto-Scripty] Re: Observing multipart/form-data oncomplete

2009-11-13 Thread Eric

Hi,

You may try to observe the iframe's onload since after a form
submission, the server is supposed to return a page.
Of course, remember that this event will also be fired on the iframe's
initial loading so you'll have a little extra plumbing to do.

Another possibility would be for the server to return something like:
Event.fire(parent.document,form:complete);
and to observe this event on your document, but it may not be that
simple to send event to/from iframe (I never tried).

Good luck,
Eric

On Nov 12, 1:37 pm, Stucture_Ulf maximilian.moulet...@gmail.com
wrote:
 I'm using document['formID'].submit() to submit a multipart/form-data
 form for multiple files upload. I want to observe the upload process
 and fire additional events once the file/files has been uploaded. I'm
 using a iframe for the upload form and looking for a way to observe
 the onComplete state of the submitted form. I'm not using the
 Ajax.Request since I'm uploading files through a iframe...feels like
 there's a simple and basic solution I've missed. Help appreciated
--~--~-~--~~~---~--~~
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: Prototype.jExtension

2009-11-13 Thread Eric

Hi Jacopo,

On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote:
 Hi Eric,
 thanks for your suggests!
 Well, now I answer all of your questions ;)
 - I named Element.ajaxRequest() in that way because by default it
 updates the element, but you can change the onSuccess function!

OK, but if you don't change the element in the onSuccess, there is no
point using this method instead of Ajax.Request.

 - I've written String#len and String#getType because some newbies may
 not knows that attributes ;)

Well, you must not forget that every single byte you add to the
library will be loaded by every single page using the library.
Peoples are already complaining because prototype is big, so if we
start to add useless things, it will be worst.
Moreover, newbies should better learn about length and the DOM
attributes instead of some exotic name not portable (and slower)
methods

 - I've re-written Array#compact: now the control is not recursive

It wasn't recursive, it was slow :o)

But still, return value != null is the same than return value (at
least when passed to Enumerable.select) and it is exactly what
Prototype.K function does.
 (thanks)

 Here is the code:http://tr.im/EBEPthe Array#comapct starts at at
 line 128

 Which methods do you suggest me to propose??

Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your
change to Array.compact sounds like useful features to me.

Eric


 Thanks,
 Jacopo.

 On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote:

  Hi,

  This has some nice ideas like Element.ajaxRequest() (which I would
  have called Element.ajaxUpdate() since it is what it does :o) ), but
  also some features I fail to see any utility to.
  I.E., what's the point to use 'string'.len() instead of
  'string'.length?
  Same thing for $('someElement').getType() instead of $
  ('someElement').nodeName

  Also, try to limit the impact on performances by avoiding tests in
  loops when you can do them outside of the loop.
  I.E, in your Array.compact version, you may replace :
    compact: function(strict) {
      return this.select(function(value) {
        return strict === true ? value != null  value.strip() != '' :
  value != null;
      });}
  ...by something like:
    compact: function(strict) {
      return this.select(strict === true ? function(value) { return
  value != null  value.strip() != '' } : Prototype.K);}

  The procedure to submit contributions is described 
  here:http://www.prototypejs.org/contribute
  You may propose some of yours (I'd recommend proposing only the more
  interesting methods) once you've validated that they don't break the
  test cases.

  HTH,
  Eric

  On Nov 10, 10:07 am, Jacopo Andrea Nuzzi jacopo.nu...@gmail.com
  wrote:

   Hi Tobie,
   thanks for you suggest: here it is:http://tr.im/EBEP

   Jacopo

   On Mon, Nov 9, 2009 at 9:35 PM, Tobie Langel tobie.lan...@gmail.com 
   wrote:

Hi jacoz,

Seems like your Array#add would benefit from using Array#splice.

   https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Object...

Best,

Tobie


--~--~-~--~~~---~--~~
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: Prototype.jExtension

2009-11-12 Thread Eric

Hi,

This has some nice ideas like Element.ajaxRequest() (which I would
have called Element.ajaxUpdate() since it is what it does :o) ), but
also some features I fail to see any utility to.
I.E., what's the point to use 'string'.len() instead of
'string'.length?
Same thing for $('someElement').getType() instead of $
('someElement').nodeName

Also, try to limit the impact on performances by avoiding tests in
loops when you can do them outside of the loop.
I.E, in your Array.compact version, you may replace :
  compact: function(strict) {
return this.select(function(value) {
  return strict === true ? value != null  value.strip() != '' :
value != null;
});}
...by something like:
  compact: function(strict) {
return this.select(strict === true ? function(value) { return
value != null  value.strip() != '' } : Prototype.K);}

The procedure to submit contributions is described here:
http://www.prototypejs.org/contribute
You may propose some of yours (I'd recommend proposing only the more
interesting methods) once you've validated that they don't break the
test cases.

HTH,
Eric

On Nov 10, 10:07 am, Jacopo Andrea Nuzzi jacopo.nu...@gmail.com
wrote:
 Hi Tobie,
 thanks for you suggest: here it is:http://tr.im/EBEP

 Jacopo

 On Mon, Nov 9, 2009 at 9:35 PM, Tobie Langel tobie.lan...@gmail.com wrote:

  Hi jacoz,

  Seems like your Array#add would benefit from using Array#splice.

 https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Object...

  Best,

  Tobie


--~--~-~--~~~---~--~~
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.move speed issue + tooltip suggestions?

2009-10-29 Thread Eric

Hi Peder,

You can adjust indirectly the speed of the effect with the duration
parameter, which is the effect duration (from start to end).

In your case, you may change:
new Effect.Move(caroImgs[imgIdx], {x: newLeft, y:0, mode:
'absolute'});
by:
new Effect.Move(caroImgs[imgIdx], {x: newLeft, y:0, mode: 'absolute',
duration:0.2});

For the tooltip script, I have no idea, but you may have a look at
http://scripteka.com/

Eric

On Oct 25, 5:17 pm, Peder Johnsen supp...@johnsendesign.no wrote:
 Hi, is there anyway to speed up the move effect?
 I am currently using it forwww.pixelgeddon.com(press the joystick
 icon).
 And the way it is now its moving a bit to slow..

 Also I wonder if anyone of you know about any good tooltip scripts
 that works with Prototype  script.aculo.us.
 It has to let me display a sepereate div with html text for each image
 in that scroller that I use the move effect for :).

 Best regards,
 Peder Johnsen.
--~--~-~--~~~---~--~~
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: A question about submitting multiple parameters using Ajax.Updater

2009-10-27 Thread Eric

 $posted=str_replace(\\,\,$__POST['varaible_2'];

It is a little off-topic here, but the back-slashes are added or not
depending of PHP's configuration.

Here is the bullet-proof way to manage parameters in PHP:
$posted = $__POST['varaible_2'];
if (get_magic_quotes_gpc())
{
  $posted = stripslashes($posted);
}

HTH,
Eric

On Oct 17, 8:12 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 it sends a json object to the server which you remove the slashes and
 decode -

 example in php

 $posted=str_replace(\\,\,$__POST['varaible_2'];

 $json=json_decode($posted);

 // $json is now a multi dimensional array you can access

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: C K Kashyap ckkash...@gmail.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Saturday, October 17, 2009 6:17 PM
 Subject: [Proto-Scripty] Re: A question about submitting multiple parameters
 using Ajax.Updater

  for example...
  var data={};

  for(i=0; i=10;++i) {
  data[i]=i;
  }
  var params=Object.toJSON(data);

  var request=new Ajax.Request(...

  parameters : {
  variable_1 : 'Hi i am variable one',
  variable_2 : params // The json object
  }
  ...

  This did not quite work ... it looks like Object.toJSON returns a
  string and on the server side what I get is

  variable_2 = {\data ...

  Regards,
  Kashyap


--~--~-~--~~~---~--~~
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: Coding disabled on a link

2009-10-20 Thread Eric

Hi,

Those solutions sound a little overkill. Something really simple
should do it, like this:

function stopEvent(e)
{
  e.stop();
}

function disableLink(link)
{
Event.observe(link,click,stopEvent);
Element.addClassName(link,'disabled');
}

function enableLink(link)
{
Event.stopObserving(link,click,stopEvent);
Element.removeClassName(link,'disabled');
}

function disableAllLinks()
{
  $$('a').each(disableLink);
}

function enableAllLinks()
{
  $$('a').each(enableLink);
}

- stopEvent() function is used by others (don't call it directly)
- if you want to disable a link with an id, you may use disableLink($
('idOfTheLink'))
- if you want to disable all links of the page, use disableAllLinks()
- addClassName and removeClassName calls are not necessary to disable/
enable the link, but as a user I really hate it when some UI component
doesn't work as it should. This allows you to provide some visual
feedback to your users.
- This is a minimalist example. If you feel like it, try to use
Element.addMethods and Function.methodize to add enable and disable
methods to links DOM elements (don't forget to extend the element at
the beginning of your method, and to return it at the end to allows
chain calls :o)

You have a fully working example here: http://jsbin.com/itike3

Eric

NB: I've lost 20 minutes (sic) figuring why my disableAllLinks()
methods didn't work as expected before finding out that $$() DOESN'T
WORK on jsbin in edit mode (it works on save to public urls)... So
think about it if it happens to you :o) ($$() seems to be replaced by $
() for some reason...)
On Sep 16, 2:12 pm, david david.brill...@gmail.com wrote:
 Hi Arnaud,

 your pasted code does not work on FF3.5.3.
 So I modify it this way, it should work on all browser, only test with
 FF3.5  IE6 :((
 Here is your version modified:

 html
 head
         script src=prototype.js type=text/javascript/script
 /head
 body
         script type=text/javascript
                 var a_create = new Element('a', {
                         id : 'btn_create',
                         href : 'javascript:linkOnClick();'}).update
 ('[ Create ]');

                 var l_create = new Element('label',
 {id:'btn_create'}).update('[ Create ]');

                 function linkOnClick() {
                         $('btn_create').replace(l_create);
                     alert(disable);
                 }

                 function activateLink() {
                         $('btn_create').update(a_create);
                         alert(activate);
                 }
         /script

         label id=btn_create[ Create ]/label
         input type=button onclick=activateLink(); value=Activate
 link /
 /body
 /html

 But multiple click on the button break the sentence. So it did not
 work well !!

 But as you request a simple version, why not doing something like
 that:
 html
 head
         script src=prototype.js type=text/javascript/script
 /head
 body
         script type=text/javascript
                 function activateLink() {
                         $('btn_create').hide();
                         $('btn_create_a').show();
                     alert(enable);
                 }
                 function linkOnClick() {
                         $('btn_create').show();
                         $('btn_create_a').hide();
                     alert(disable);
                 }
         /script

         label id=btn_create[ Create ]/label
         label id=btn_create_a style=display:nonea
 href=javascript:linkOnClick();[ Create ]/a/label
         input type=button onclick=activateLink(); value=Activate
 link /
 /body
 /html

 It's simpler and work in all case even on multiple click on the
 button.
 But depending on what you want to do, there could have a lot of
 possibilities to achieve to this.

 btw, you use DOM0 event to trap the mouse click, have a look 
 at:http://prototypejs.org/api/event
 to know how to use event with prototype. So you could use Event.stop
 (Alex exemple), or the preventDefault property.
 And you could define multiples events on the same element id using
 this way.

 --
 david

 On 15 sep, 17:02, Arnaud Feltz arnaud.fe...@gmail.com wrote:

  2009/9/14 Arnaud F. arnaud.fe...@gmail.com

   Hello,

   i need to disable a link in some case.

   What I do actually is something like this :

   html
   head
          script src=javascript/prototype.js type=text/javascript/
   script
   /head
   body
          script type=text/javascript
                  var a_create = new Element('a', {
                          id : 'btn_create',
                          href : 'javascript:linkOnClick();',
                          innerText : '[ Create ]'});

                  var l_create = new Element('label',{id:'btn_create',
   innerText:'[ Create ]'});

                  function linkOnClick() {
                          $('btn_create').replace(l_create);
                      alert(disabled);
                  }

                  function

[Proto-Scripty] Re: Tying an Element and a custom class together

2009-10-19 Thread Eric

Matt,

I like your way of doing it, but my concern is that the documented
toElement() method seems to be only half implemented.
A minor change to the $() function could make it work completely (see
it here: http://pastie.org/660553 ).

What do you guys think about this change?

Eric

On Oct 17, 12:11 am, Matt Foster mattfoste...@gmail.com wrote:
 Quick and dirty, im sure there are errors but conceptually this would
 be my approach...

 var ElementProxy = Class.create({
                         initialize : function(ele){
                                 this.element = $(ele);
                                 this.nodeType = this.element.nodeType;
                                 this.tagName = this.element.tagName;
                                 this.delegateMethods();
                         },
                         delegateMethods : function(){
                                 var methods = Element.Methods;
                                 for(var method in methods){
                                         var __method = methods[method];
                                         if (Object.isFunction(__method)  
 !(__method in this))
                                                 this.assignMethod(method, 
 __method);
                                 }
                         },
                         assignMethod : function(method, __method){
                                 this[method] = function(){ return 
 __method.apply(this.element,
 [this.element].concat($A(arguments))); };
                         }
                 });

 --

 http://positionabsolute.net

 On Oct 16, 3:01 pm, Matt Foster mattfoste...@gmail.com wrote:

  The has a relationship is the only way to go for sure.

  You could create an ElementProxy class that inherits all the Element
  methods but just keeps a reference to the actual DOM reference
  internally. All of the Element.Methods are parameterized so I'm sure
  there'd be an easy way to delegate the reference.  As long as the
  ElementProxy class implements all the regular methods then core
  prototype processes wouldn't know the difference between the two.

  --

 http://positionabsolute.net

  On Oct 16, 12:02 pm, Eric lefauv...@gmail.com wrote:

   Hi,

   While I agree with T.J. arguments, there are cases when it is nice to
   have this behavior (DOM element and Plain object in the same
   object). On of those case is, for example when you're creating a new
   control class.

   The way I do it is:
   - building the DOM element in the class's constructor (and keeping it
   in an attribute) (*)
   - implement the toElement() method in the class (to return this DOM
   element) (*)

   The second step allows you to provide your class instance to any
   prototype method instead of a DOM element.
   A small example:http://jsbin.com/omaza

   Ops: Previous sentence was wrong... After trying to write the
   example, and checking in the source, it seems that you can only use
   this kind of object as a DOM element in a handfull of prototype's
   methods (insert, update and replace)...

   Is it any reason why this behavior is not implemented in $() (this
   would actually allow to use a custom class everywhere where a DOM
   element is needed, and just add one line of code).

   Eric

   (*) This was the simplest way to explain the process, but you may
   prefer dynamically create the DOM element on the first call of
   toElement() for better efficiency.
   On Sep 10, 10:56 am, T.J. Crowder t...@crowdersoftware.com wrote:

Hi Andrea,

FWIW, I'd say the best practice is:  Don't do that, it conflates the
model with the view *and* the controller. :-)  (MVC is not by any
means the only game in town, but the terminology is useful for
questions like this.)  If you ever want to present the business object
in two different ways in two different panels (in a list, for
instance, and in a details pane that shows the details of the
highlighted object in the list), you can't, or rather the code gets
ugly fast.

Instead, I'd suggest keeping the business object separate from the
element and using a has a rather than an is a relationship.  You
can do that by storing the business object ID on the element in some
way (data-key is the attribute I usually use for this, and fits with
the proposed HTML5 data attributes standard), either directly or via a
small controller.

The business object should never update the element directly, and so
it doesn't need to know about it.  Instead, it should raise events
that controllers can respond to by updating the elements they
control.  When I say fire event, I'm not necessarily talking
browserspeak (I wouldn't use browser events for this), just a minimal
implementation of the Observer pattern (as a mixin or similar you can
use for lots of different objects).

FWIW, and apologies if I went OT, but I hope I didn't,
--
T.J. Crowder
tj / crowder

[Proto-Scripty] Re: Tying an Element and a custom class together

2009-10-16 Thread Eric

Hi,

While I agree with T.J. arguments, there are cases when it is nice to
have this behavior (DOM element and Plain object in the same
object). On of those case is, for example when you're creating a new
control class.

The way I do it is:
- building the DOM element in the class's constructor (and keeping it
in an attribute) (*)
- implement the toElement() method in the class (to return this DOM
element) (*)

The second step allows you to provide your class instance to any
prototype method instead of a DOM element.
A small example: http://jsbin.com/omaza

Ops: Previous sentence was wrong... After trying to write the
example, and checking in the source, it seems that you can only use
this kind of object as a DOM element in a handfull of prototype's
methods (insert, update and replace)...

Is it any reason why this behavior is not implemented in $() (this
would actually allow to use a custom class everywhere where a DOM
element is needed, and just add one line of code).

Eric

(*) This was the simplest way to explain the process, but you may
prefer dynamically create the DOM element on the first call of
toElement() for better efficiency.
On Sep 10, 10:56 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi Andrea,

 FWIW, I'd say the best practice is:  Don't do that, it conflates the
 model with the view *and* the controller. :-)  (MVC is not by any
 means the only game in town, but the terminology is useful for
 questions like this.)  If you ever want to present the business object
 in two different ways in two different panels (in a list, for
 instance, and in a details pane that shows the details of the
 highlighted object in the list), you can't, or rather the code gets
 ugly fast.

 Instead, I'd suggest keeping the business object separate from the
 element and using a has a rather than an is a relationship.  You
 can do that by storing the business object ID on the element in some
 way (data-key is the attribute I usually use for this, and fits with
 the proposed HTML5 data attributes standard), either directly or via a
 small controller.

 The business object should never update the element directly, and so
 it doesn't need to know about it.  Instead, it should raise events
 that controllers can respond to by updating the elements they
 control.  When I say fire event, I'm not necessarily talking
 browserspeak (I wouldn't use browser events for this), just a minimal
 implementation of the Observer pattern (as a mixin or similar you can
 use for lots of different objects).

 FWIW, and apologies if I went OT, but I hope I didn't,
 --
 T.J. Crowder
 tj / crowder software / comwww.crowdersoftware.com

 On Sep 9, 3:02 pm, Andrea Campi andrea.ca...@gmail.com wrote:

  Hi,

  in my application I need JS objects to represent some business
  objects, which are represented on the page by an Element.
  I would like to be able to tie the two together in such a way that I
  can use them interchangeably.
  This sounds like it should be a common pattern, so I was wondering
  what the best practices are.

  Example:

  var Foo = Class.create({
    initialize: function(parent) {
      var element = Object.extend(new Element(div, { 'class': 'foo',
  'id': 'myFoo' }), this);
      parent.insert(element);
    },

    bar: function() {
    }
    // more methods

  };

  Thanks to Object.extend I can easily call: $('myFoo').bar()
  But I cannot do the opposite, for instance:

  var foo = new Foo();
  foo.childElements();

  Note that it would just work if I could return 'element' (which now
  behaves like Foo).
  However, I've readhttp://dev.rubyonrails.org/ticket/11481andit has
  reasonable objections to letting the constructor return a value.

  So, what gives? Any suggestion?

  TIA,
    Andrea


--~--~-~--~~~---~--~~
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: prototype mobile support: best practices?

2009-10-09 Thread Eric

Hi,

I once made an imode version of a website.
First thing, instead of having if(Mobile...) everywhere, you may
consider using a dedicated CSS file (easy to do on server side). This
will do 99% of the trick (changing menus layouts, using more suitable
font/colors, hiding advertisings, using lightweight/smaller images,
etc...).

You may also add some class to the body and select objects you want
handlers to with that...
OK, this was not very clear :o) A small example :
body class=HasPointer
  .../...
  div id=menuBar .../... /div
  .../...
/body

Then, instead of having:
$(menubar).observe(over, ...);

you can use:
$$(.HasPointer #menuBar).invoke(observe,click,...);

So, if you're serving a pointerless terminal, you just don't add the
HasPointer class to body element, and the $$() statement will do
nothing.

Just a couple of other considerations to think about:
- Phones/PDA's CPUs are often slower than a desktop PC, so be careful
if you do extensive client processing (like using the DOM to create
1000 rows table). When possible, try to test the site on the actual
device (emulators don't usually run at the real speed)
- In some country, peoples pay their mobile internet access according
to the volume of dl data, and the dl speed can be very slow on some
poor covered areas. So, it would be nicer to do your if(mobile)
tests server side, to avoid having the mobile browser downloading both
its code and the desktop version code it will not use.
- If you do the point above, it is very important that you check your
generated file WILL BE CACHED (by default, most dynamic pages are NOT
cached).

That's all I can remember about this.
HTH

Eric

On Aug 14, 2:09 pm, Cyrus arianglan...@googlemail.com wrote:
 I can't believe no one has tested his projects with a mobile / touch
 screen device ...

 On 29 Jul., 11:11, Cyrus arianglan...@googlemail.com wrote:

  Hi,

  while testing my prototype scripts on Mobile Safari I have seen, that
  they might need extra attention in my code ;)

  E.g. I have a menu bar that is only visible when I move the mouse.
  There is no mouse (movement) on a touch screen device, so I need to do
  some adjustments.

  Are there any best practices / recommendations how to write this kind
  of code? I guess a simple
  if (MobileBrowser) is enough, but is there anything already
  available within prototype framework?


--~--~-~--~~~---~--~~
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] Ajax.InPlaceCollectionEditor issues (and some solutions)

2009-10-06 Thread Eric

Hi,

I tried to use for the first time Ajax.InPlaceCollectionEditor, and
got few issues that I would like to share with you, just in case it
can save you some time.

* First, I am using scriptaculous 1.8.2. I found out that in this
version, the InPlaceCollectionEditor was broken (raising a JS error in
IE because the editor's element was not extended).

I found a fix here :
https://prototype.lighthouseapp.com/projects/8887/tickets/163-ajaxinplacecollectioneditor-seems-to-be-broken-in-182
(last post of the page).
However, I am not sure the first added line (Element.extend(fld);) is
needed since the InPlaceEditor was not raising any error on IE (but it
doesn't seems to hurt).

* Then, I found out that the submitOnBlur option was not supported,
and that ESC and Return keys didn't act as expected (i.e cancel or
confirm the edition). Here is my fix for that (including the fix from
previous link):
  555a556
Element.extend(fld);
  765a767,770
if (this.options.submitOnBlur)
  list.onblur = this._boundSubmitHandler;
Element.extend(list);
list.observe('keydown',this.checkForEscapeOrReturn.bind(this));

also on http://pastie.org/643890. Since it is not really readable, I
pasted the full createEditField method here : http://pastie.org/643897
(the 4 lines I've modified begins by /*EA*/).

However, if it works great on FF2-3 and IE7-8, for some reasons IE6 is
sending a blur event to the select control when it inserts it in DOM,
so the list appears and disappears in an eye blink...
I think I can workaround the issue by using IE's conditional comments,
but if somebody can think to a way to make it work on IE6, it would be
great.

* Last issue, which is not technically a bug but a very unexpected
behavior:
  I had some options in my collection's parameter which were two
characters long. Since the InPlaceCollectionEditor considered them as
a two element's array, he thought I was trying to provide an
alternative value for my list choices.
For example, if you use ['AB','CD'], your list will list 'B' and
'D' (and will post respectively 'A' and 'C' if you select them).
Simple workaround is to explicitly specify the value of the option,
like this: [['AB','AB'],['CD','CD']]

Thanks for any hint about the IE6 issue!
Eric

NB: Sorry if I don't reply straight away to your replies, but I am
trying to read all posts from this list in order, and I am a little
behind schedule right now (just read 1st July's ones :o) )

NB2: I first made a search on this group for
InPlaceCollectionEditor , but it returned only 2 posts (from 1st and
2nd october) while a google search find some more... so don't trust
the Search this group button...
use a google search on site://groups.google.com/group/prototype-
scriptaculous inplacecollectioneditor if the Search this group
didn't return what you were looking for :o)
--~--~-~--~~~---~--~~
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: Ajax.InPlaceEditor in tables in IE6

2009-08-19 Thread Eric



On Aug 18, 7:11 pm, ColinFine colin.f...@pace.com wrote:
 What's wrong with putting divs in tables (inside the table cells, of
 course)?

Well, it is not that bad, but usually it falls in one of two cases:
- The table is an actual table, and there is no (or very few) need to
use divs in its cells.
- The table is used as a page layout, and mixing tables and divs for
page layout is not very elegant.

There is also a lots of side effects which can occur when you mix
different kind of overflow styles (you can end with divs bigger than
their containing cells...).

But I agree with you that when you know what you're doing, it is not
that bad :o)

Don't anybody has a clue about my InPlaceEditor issue?
I would be very curious to know (at least) why using InPlace editing
on a TD element make it vanish...

Eric
--~--~-~--~~~---~--~~
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] Ajax.InPlaceEditor in tables in IE6

2009-08-14 Thread Eric

Hi,

I have a table with some editable cells.
The initial content of cells may be empty. I'd like the InPlaceEditor
(IPE) to start editing when user clicks anywhere in the cell (which
can be larger than the actual text content).

I managed to achieve this in IE8 and FF2-3.5, but once again, IE6 adds
some spice in my life...

I made a minimal case on pastie: http://pastie.org/584025 with the
three approaches I tried so far.

Here are the interesting parts:
  style span.IPE {display: block;} /style
  script type='text/javascript' language='javascript'
document.observe(dom:loaded,function()
{
  $('t').select('.IPE').each( function(div)
  {
new Ajax.InPlaceEditor(div,'something.php', {});
  });
});
  /script

  table id=t
thead
  trthX title/ththY title/ththZ title/th/tr
/thead
tbody
  tr
tddiv class=IPEA/div/td
tdspan class=IPEB/div/td
td class=IPEC/td
  /tr
/tbody
   /table

So, what is happening:
- First case, using a div container (*) : Works as expected on IE8 and
FF but on IE6 you have to click on the actual text to activate InPlace
editing.
- Second case, using a span with display: block: Work as expected on
FF, but IE8 for some reason uses now a textarea instead of an input
for edition (so does IE6 if you click on the actual text, but you
still have to click on actual text)
- Third case, using the TD as IPE's target: This is an interesting
one...
All browsers (including IE6!) react when the cell is clicked (no need
to click on the actual text), however the reaction is Make the TD and
its content disappear!

Another interesting thing in IE6 is that if the IPE reacts only when
mouse is on the actual text, the highlight effect is performed on the
actual div/span/td, which fills the whole table's cell...

I cannot think to something else to try...
If someone has an idea about how to make this work, I'd be glad to
read it!

Eric

Note: I use XHTML 1.0 Transitional doctype (see pastie link for the
complete source)
(*) I am aware it is bad to put divs in tables, but so far that's the
best working option :o(
Better alternatives are welcome ;o)
--~--~-~--~~~---~--~~
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: Ajax.InPlaceEditor in tables in IE6

2009-08-14 Thread Eric

Ooops, I forgot to tell that I am using Prototype 1.6.0.3 and Scripty
1.8.2 :o)

Eric

On Aug 14, 4:35 pm, Eric lefauv...@gmail.com wrote:
 Hi,

 I have a table with some editable cells.
 The initial content of cells may be empty. I'd like the InPlaceEditor
 (IPE) to start editing when user clicks anywhere in the cell (which
 can be larger than the actual text content).

 I managed to achieve this in IE8 and FF2-3.5, but once again, IE6 adds
 some spice in my life...

 I made a minimal case on pastie:http://pastie.org/584025with the
 three approaches I tried so far.

 Here are the interesting parts:
   style span.IPE {display: block;} /style
   script type='text/javascript' language='javascript'
     document.observe(dom:loaded,function()
     {
       $('t').select('.IPE').each( function(div)
       {
         new Ajax.InPlaceEditor(div,'something.php', {});
       });
     });
   /script

   table id=t
     thead
       trthX title/ththY title/ththZ title/th/tr
     /thead
     tbody
       tr
         tddiv class=IPEA/div/td
         tdspan class=IPEB/div/td
         td class=IPEC/td
       /tr
     /tbody
    /table

 So, what is happening:
 - First case, using a div container (*) : Works as expected on IE8 and
 FF but on IE6 you have to click on the actual text to activate InPlace
 editing.
 - Second case, using a span with display: block: Work as expected on
 FF, but IE8 for some reason uses now a textarea instead of an input
 for edition (so does IE6 if you click on the actual text, but you
 still have to click on actual text)
 - Third case, using the TD as IPE's target: This is an interesting
 one...
 All browsers (including IE6!) react when the cell is clicked (no need
 to click on the actual text), however the reaction is Make the TD and
 its content disappear!

 Another interesting thing in IE6 is that if the IPE reacts only when
 mouse is on the actual text, the highlight effect is performed on the
 actual div/span/td, which fills the whole table's cell...

 I cannot think to something else to try...
 If someone has an idea about how to make this work, I'd be glad to
 read it!

 Eric

 Note: I use XHTML 1.0 Transitional doctype (see pastie link for the
 complete source)
 (*) I am aware it is bad to put divs in tables, but so far that's the
 best working option :o(
 Better alternatives are welcome ;o)
--~--~-~--~~~---~--~~
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: Casting a json object into an instance of a class

2009-08-12 Thread Eric

Thanks for your reply T.J.!

I did used Class instead of class. This was a typo when I posted :o)

You're right, it should have work the way I did it... and it actually
did work this way...
...except that due to a mistake in my events handling, my new thing
value was overridden by some obsolete part of code just after being
converted into a class instance :o(
And since it was overridden by the raw JSON object value, I stupidly
assumed that the casting didn't work.

At least, I now know what is the state of the art way of getting a
class instance through Ajax ;o)

Thanks again!
Eric

On Aug 12, 10:49 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 That should work.  I notice that you have class.Create rather than
 Class.create; I assume that's just an error in the note and that the
 actual code uses Class.create?  Because if not, that's your problem.

  if(myInstance.isB())...

  = isB is undefined

 That indicates there's a different problem.  isB should be defined
 regardless, you defined it in your class definition.  If the
 Object.extend thing weren't working, it should *return* undefined, but
 not *be* undefined.

 FWIW, this works:
 * * * * (also athttp://pastie.org/581050)
 // Defining
 var Thing = Class.create({
 initialize: function(src)
 {
 if (src) {
 Object.extend(this, src);
 }
 },

 isB: function()
 {
 return this.b;
 }

 });

 // Using:
 var t;
 t = new Thing({b: true});
 alert(t.isB() ?  + t.isB());
 * * * *

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

--~--~-~--~~~---~--~~
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] Casting a json object into an instance of a class

2009-08-11 Thread Eric

Hi,

I make some Ajax calls to fetch objects from my server, and I would
like those object to be instance of some class.
I just cannot find a way to achieve this...

Here is what I've tried so far :

var MyClass = class.Create({
  initialize: function(src) {
if(src) Object.extend(this,src);
  },
  isB: function() { return this.b;}
});

var myJsonObject = {a:0, b:true}; // xrh.responseJSON

myInstance = new MyClass(myJsonObject);

if(myInstance.isB())...

= isB is undefined

I also tried the opposite approach with:
myInstance = Object.extend(myJsonObject,MyClass.prototype)

if(myInstance.isB())...
= isB is undefined

What is the correct way of achieving this ?

Eric
--~--~-~--~~~---~--~~
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] Ajax.Responders issues

2009-08-05 Thread Eric

Hi,

I am trying to setup some basic Ajax framework, and I was thinking to
use Ajax.Responders to intercept some events, but I meet the following
issues :
- First, it seems that the responders ignore an onSuccess() callback
passed through Ajax.Responders.register().
This may be a documentation error since the Prototype 1.6 - The
Complete API Reference says that All callbacks in the life-cycle are
available on the Ajax.Responders.register() description (p32) but the
list of Responder callbacks (p25) only lists 7 of them (not including
onSuccess).

My second concern is that Responder's callback seems to be always
called after the local one (the one defined in the ajax call).

I wanted to implement some kind of server throwable exceptions,
which basically would allow me to return a JSON object with some
attributes like {Error:true, Code:ExpiredSession...} which would
be handled by the default Responder, freeing me from having to test
all unexpected things in every Ajax's callback.

The current behavior doesn't allow to do that easily.
I do think to a solution but don't you think that for the sake of
clarity those Responder callback should be renamed from onXXX to
onAfterXXX since they are called after the actual onXXX callback ?
(and eventually, some onBeforeXXX callback could be added (as well
as onSuccess and onFailure).

I am not very happy with the workaround I found, so feel free to give
me some hints to make it better.
Here it is:

function ResponderOnSuccess(localOnSuccess,request,jsonObj)
{
  if(!jsonObj) jsonObj = { Error: true, Code:Unknown};
  if(jsonObj.Error)
  {
// process error;
  }
  else
  {
localOnSuccess(request,jsonObj);
  }
}

and for using it:
new Ajax.Request('myRequest.php',
  {
onSuccess: myCB.wrap(ResponderOnSuccess)
  });

or if you prefer:
new Ajax.Request('myRequest.php',
  {
onSuccess: (function(xrh,json)
{
  // Process data here
}).wrap(ResponderOnSuccess)
  });



Last minute idea I just had while writing: Do you think I could use
the onCreate's responder to change the onSuccess by the wrapped
version?

Thanks for any hint,
Eric
--~--~-~--~~~---~--~~
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] I felt rather puzzled at a few code in Class.create function. Anyone else who can help me. TIA

2009-05-19 Thread Eric

if (parent) {
  var subclass = function() { };
  subclass.prototype = parent.prototype;
  klass.prototype = new subclass;
  parent.subclasses.push(klass);
}

How to understand these codes ?
--~--~-~--~~~---~--~~
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: I felt rather puzzled at a few code in Class.create function. Anyone else who can help me. TIA

2009-05-19 Thread Eric



On 5月19日, 下午6时52分, Eric smcdl6...@gmail.com wrote:
 if (parent) {
   var subclass = function() { };
   subclass.prototype = parent.prototype;
   klass.prototype = new subclass;
   parent.subclasses.push(klass);
 }

 How to understand these codes ?

If I was the author, I will new parent directly and assign it to
klass.prototype.
So why use usbclass as broker ?
--~--~-~--~~~---~--~~
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: I felt rather puzzled at a few code in Class.create function. Anyone else who can help me. TIA

2009-05-19 Thread Eric

I had understood it completely. I'm Chinese, sorry for my english.
Best  Thank you.

On 5月19日, 下午7时28分, Tobie Langel tobie.lan...@gmail.com wrote:
 Hi Eric,

  If I was the author, I will new parent directly and assign it to
  klass.prototype.

 That would imply calling the initialize method of the parent class
 which is something you'd want avoid.

  So why use usbclass as broker ?

 subclass is an empty function (parent isn't: it calls
 parent.prototype.initialize), so instantiating it to define
 klass.prototype doesn't have any potentially unwanted side effects.

 Hope this clarifies your question.

 Best,

 Tobie
--~--~-~--~~~---~--~~
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: validation for alphanumeric field/sequence

2009-03-02 Thread Eric

Hi,

On Feb 4, 10:50 pm, Michael mich...@vermontsnows.com wrote:
 Hi - I want to use this validation for an alphanumeric field.

I apologize for beating a dead horse, but since the list of possible
choices is closed, why don't you just use a SELECT element?

:o)

Anyways, it was very interesting to read about all possible methods,
even if I am now (even more) confused about Javascript and hashes :o/
(I thought that native JS objects were great hashes, but I am
obviously wrong there...).

Eric

--~--~-~--~~~---~--~~
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: new Elemente in ie6 didn't work

2009-02-17 Thread Eric

Hi T.J.

On Jan 19, 12:31 pm, T.J. Crowder t...@crowdersoftware.com wrote:
  On my machine, the DOM version takes at least 10 times longer than the
  HTML version.

Did you use prototype DOM (x=new Element('P',{...});...) or plain
old vanilla DOM (x=document.createElement('P');...) ?

I was thinking to revert to vanilla DOM for performances issues but I
may revert to build some HTML string if it is that fast :o)
(Isn't it what scritaculous's Builder is doing internally?)

Eric

--~--~-~--~~~---~--~~
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: Applying scriptaculous effects on CSS styles

2009-02-09 Thread Eric

Hi bminihan,

On Feb 9, 3:59 pm, bminihan bjmini...@gmail.com wrote:
 Why not just switch all of your elements to a different class, with
 the new effect?

 .FOO { opacity: 1.0 }
 .BAR { opacity: .9 }

 $$(.foo).each( function (item) { item.className = BAR; })

Well, changing 300 times a class would take about the same time that
changing 300 times the opacity (even more since you have to remove the
previous one).
Moreover, I am looking for smooth transition. I don't think there is
an effect that allow iterating a collection of classNames and setting
it to the objects one after another (but this could give some
interesting effects :o) ).

The interest here is to change a single variable and impact hundreds
(thousands?) of DOM objects in an eye blink.

Eric

NB: BTW, since classNames is a collection, you may not affect it this
way but instead use Element.addClassName() and Element.removeClassName
().
--~--~-~--~~~---~--~~
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] Using setStyle to change background-image

2009-02-03 Thread Eric

Hi,

I have a div and I'd like to set its background image style using the
object format.

I tried without success the following things:

$('mydiv').setStyle({'backgroundImage':'wait.gif'});
$('mydiv').setStyle({'backgroundImage':'url(wait.gif)'});
$('mydiv').setStyle({'background-image':'wait.gif'});
$('mydiv').setStyle({'background-image':'url(wait.gif)'});

It doesn't rise any error but doesn't set the background either.

The only working way I found until now is using the string format
parameter.
This one works:
$('mydiv').setStyle('background-image:url(wait.gif);'});

I really would like to use the object form, which is working for other
style properties on the very same object.
(ex: $('mydiv').setStyle({'left':xpos+'px','top':ypos+'px'}); )

Am I missing something here?

Thanks for any hint.

Eric
--~--~-~--~~~---~--~~
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: Using setStyle to change background-image

2009-02-03 Thread Eric

2009/2/3 Richard Quadling rquadl...@googlemail.com:
 The attribute name should not be in quotes ...

Thanks for the reply Richard,

But I also tried without the quotes, which are optional (except for
'background-image' since in contains a dash).
Documentation says Element.setStyle should accept both casing (dom-
like (with-dashes) and javascript like (withCamelCase) but it looks
like none of them work for this property...

I would really like to use object format in order to set many
parameters in one call without doing heavy string processing (I may
have to do it on up to 2000+ DOM objects when page is loaded...).

Any idea about what I am missing?

--~--~-~--~~~---~--~~
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] I think i found a bug in IE6(not yet test in IE7), it will throw a error when I create a instance object in sub window use the Class defined by its opener.

2009-01-16 Thread Eric

Hi guys,

The following is my environment
Windows2000 English Professional
Prototype's version is 1.6.0.3,
IE6.0.2800.1106   test fail
Firefox2.0.0.20 test ok

The following is my code snippet
in window named 'A' :

SomeClass = Class.create();

in window named 'B' :

SomeClass = opener.SomeClass;

new SomeClass(...);

The following is result
in IE6
 throw a error Invalid procedure call or argument

in Firefox2
 just ok.

Who can tell me why ?

--~--~-~--~~~---~--~~
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: change link behavior by classname

2009-01-12 Thread Eric

On Dec 27 2008, 3:38 am, kangax kan...@gmail.com wrote:
 document.observe('click', function(e, el) {
   if (el = e.findElement('.myClassName')) {
     e.stop();
     alert(e.element().href);
   }

 })

Wouldn't it be:
if ((el = e.findElement('.myClassName'))!=document) {

?

Prototype 1.6 Complete API Reference claims that Event.findElement
returns the document if no matching element is found :o)

Subsidiary question:
Would something like this do the same, and what are the disadvantages
comparing to your solution:

$$('a.myClassName').invoke('observe','click',function(e) {
 e.stop();
 alert(e.element().href);
}

Since we are in this area, the API Reference guide is unclear about
the correct prototype of event handler functions, and I cannot found
what is supposed to be its second argument (I am betting on
event's .element() object but I could use a confirmation :o) ).

Thanks in advance,
Eric

--~--~-~--~~~---~--~~
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] New use case for Sortable tree?

2009-01-07 Thread Eric

I am using Sortable with tree enabled on a list like below:

   Group 1
   Item 1
   Item 2
   Item 3
   Group 2
   Item 4

Here, both Groups and Items can be dragged.  Additionally, Items can
be dragged into Groups (each Group contain an UL).  However, I want to
prevent Groups from being dragged into Groups, but there doesn't seem
to be an option in Sortable to achieve that.

The solution would be something like being able to specify accept
class names for the Sortable tree's nested ULs, so only Items would be
allowed inside Groups.  But that doesn't seem to be possible.  Is
there something that I am missing, or would doing this require me to
extend Sortable's implementation myself?

Thanks,
Eric



By the way, in the course of implementing my drag-and-drop tree, I
found the tree-dump output of Sortable tree to be clumsy to use on the
server side, because it would require me to recreate the tree in the
database each time.  Instead, I added a Draggables observer for the
onEnd event to capture each sorting action, and send to the server
only the change that was made: what element was dragged, which
container it was dragged to and at what position.  This required a bit
of additional coding to determine the location and position of dragged
element, but made the server side code simpler and faster.  I am just
curious, have other people done the same?

--~--~-~--~~~---~--~~
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: Newbie Question

2009-01-07 Thread Eric

What you need is to have the server side script, in this case
DeleteGroupMember.php, return a HTML fragment containing the new
list.  Ajax.Updater will then automatically insert that fragment into
the element lmnt.

Prototype has very good documentation on this site: 
http://www.prototypejs.org/api

Eric

On Jan 6, 8:52 am, Drakhul drak...@gmail.com wrote:
 I am very new to Prototype and JavaScript, so this is prolly a no-
 brainer for most of you.

 Let me see if I can make sense...

 On my page, there is a DIV where my ajax calls load pages.  The main
 page loads with a specific form loaded in the div.  The user clicks a
 link that calls another page (Group Manager) to load in the div.  One
 of the options on that page is to remove a member from this group by
 clicking a delete button.  when the button is clicked, I am calling
 the script that actually deletes the member.  I have this function
 running and everything works fine, but what I cannot figure out is how
 to is to reload the Group Manager page after the delete script
 runs.  Right now all I get is a blank page in the div.  There is a
 function to load that page.  Here is what I have:

 UserRemoveGroupMember = function(WGUID) {
         lmnt = UserContent;
         new Ajax.Updater( lmnt, 'src/DeleteGroupMember.php',
                 {
                         parameters: 'WGUID='+ WGUID,
                         evalScripts: true,
                         method: 'post',
                         onSuccess: function()
                         {
                                 UserProfileToggleManageGroups();
                         }
                 }
         );

 }

 I hope I made sense..  lol

 Thanks folks!

 -Mike D
--~--~-~--~~~---~--~~
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: event.observe document

2009-01-07 Thread Eric

On Dec 16 2008, 12:23 am, Gabriel Gilini gabr...@usosim.com.br
wrote:
 Since he probably has to watch a group of inputs, observing the document is
 obviously the better choice.
 Event propagation isn't a bad thing at all.

I think that what Matt has in mind was observing the document and use
propagation in order to have key shortcuts working almost everywhere,
and observing the inputs where shortcuts are not supposed to be
enabled with a handler that stop propagation to the document.

Both solutions seems equally elegant to me, but I am not an expert :o)

Eric


 On Mon, Dec 15, 2008 at 2:08 PM, Matt Foster mattfoste...@gmail.com wrote:

  You could also listen to those events on the input, and stop their
  propagation so that the document never hears of them.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >