Re: [Proto-Scripty] Silly Question

2011-10-28 Thread Richard Quadling
Locally, I had to put delays on my server code to actually allow this
to be visible. Once I was convinced things were working, I removed the
delay and I don't think I ever so it now.


On 11 October 2011 15:08, Phil Petree phil.pet...@gmail.com wrote:
 I'm with you Richard.

 I have a hidden div that loads the spinner and in the AJAX onCreate I
 disable the form and unhide the div while in the  onComplete I hide the div
 and enable the form.

 What I have found is that if the AJAX call starts and completes quickly then
 the spinner never gets displayed as the browser is smart enough not to do
 a repaint if not needed.

 On Tue, Oct 11, 2011 at 7:12 AM, Richard Quadling rquadl...@gmail.com
 wrote:

 On 11 October 2011 00:04, nelian i...@myskills.co.za wrote:
  I am somewhat new to AJAX, but one thing that I have not touch upon is
  the following -
 
  When my App is making an AJAX call, from the users perspective it
  seems to be doing nothing, how does one go about freezing the page
  (Not sure what else to call it) and indicate to the user that
  something is happening?
  (I have seen it on a couple of sites, but cannot seem to find an
  example at the moment)
 
  Thanks in advance for the help
 
  Ian
 
  --
  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.
 
 

 I use the Ajax.Responders
 (http://api.prototypejs.org/ajax/Ajax/Responders/) to allow me to
 handle the creation and completion of all AJAX requests.

 In my requests, I fade in a little spinner image after 0.25s. It fades
 out on completion.

 So, if the request is handled in handled in under 0.25s, then no spinner.

 This seems to work quite well for me.

 --
 Richard Quadling
 Twitter : EE : Zend : PHPDoc
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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




-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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



Re: [Proto-Scripty] Re: Adding CSS-Rules to a styletag in Prototype

2011-10-28 Thread Richard Quadling
On 20 October 2011 13:30, Luke lukas.bomb...@googlemail.com wrote:
 Thanks, Joe T.
 Walter: The problem is, that on my page the user can add/remove contents and
 also change the styles of those contents dynamically using JS. Now if you
 set a Style to certain elements, either via changing the style-tag or adding
 a class-name and *afterwards* add content, that content won't be styled. Of
 course, I save the applied style-settings in my backend and so I could apply
 the style-definitions when I generate the added content, but that maybe that
 might not be the case anymore in the future and also it's easier to set a
 style-definition in a style tag, rather than doing the backend-thing.

I've no idea if this will be useful, but just to explain some background.

I have a page which displays about 100 company names in columns
(rather than in rows). To achieve this, knowing the maximum width of
the elements was required and then setting the CSS width for that
style so all were styled correctly.

IE, FF and Chrome supported.

Also, I use a CSS and JS combinator, so I only have 1 JS and CSS file request.

Working on using a single image one also, so 4 loads per page (HTML,
CSS, JS and IMG). CSS, JS and IMG are cached, so page loading is a LOT
faster and server load WAY down.

But I digress ...

function sizeElements(o_Container)
{
console.group('sizeElements(', arguments, ')');

// Set the size on formInput labels and scrollBox labels
// Siblings only.
['.formInput  label', '.scrollBox  label'].each
(
function(s_CSS)
{
console.group('sizeElements.each(', arguments, ')');

// Size the labels to the widest.
var i_LargestLabel = o_Container.select(s_CSS +
':not(.nonSpacing):not(.shortNonSpacing)').invoke('getWidth').max();

// If there was a size, then update the container's CSS 
rule.
if ( i_LargestLabel != undefined)
{
var o_CSS = window.document.styleSheets[0];
var o_CSSRules = (o_CSS.cssRules) ? 
o_CSS.cssRules : o_CSS.rules;
var o_CSSRule =
o_CSSRules[$A(o_CSSRules).pluck('selectorText').invoke('toLowerCase').indexOf('#'
+ o_Container.id.toLowerCase() + ' ' + s_CSS.toLowerCase())];

o_CSSRule.style.width = i_LargestLabel + 'px';
}
console.groupEnd();
}
);

console.groupEnd();
}


Programmatically, I'm looking to set the width on the CSS rules of

.formInput  label
and
.scrollBox  label



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

-- 
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] Silly Question

2011-10-11 Thread Richard Quadling
On 11 October 2011 00:04, nelian i...@myskills.co.za wrote:
 I am somewhat new to AJAX, but one thing that I have not touch upon is
 the following -

 When my App is making an AJAX call, from the users perspective it
 seems to be doing nothing, how does one go about freezing the page
 (Not sure what else to call it) and indicate to the user that
 something is happening?
 (I have seen it on a couple of sites, but cannot seem to find an
 example at the moment)

 Thanks in advance for the help

 Ian

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



I use the Ajax.Responders
(http://api.prototypejs.org/ajax/Ajax/Responders/) to allow me to
handle the creation and completion of all AJAX requests.

In my requests, I fade in a little spinner image after 0.25s. It fades
out on completion.

So, if the request is handled in handled in under 0.25s, then no spinner.

This seems to work quite well for me.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Image cache problem with Ajax

2011-09-30 Thread Richard Quadling
On 30 September 2011 10:27, Chris Sansom ch...@highway57.co.uk wrote:
 Right - time to deal with all these helpful answers I've been getting, but 
 first, to save time, let me say... it's fixed! And a very simple fix it was 
 too, which I /thought/ I'd already tried...

 On 29 Sep 2011, at 17:15, Richard Quadling wrote:
 Create a test case where it goes wrong. Write new clean code that
 doesn't want/need/use anything from the main project.

 I had just prepared such a project when I found the answer among the answers 
 below!

 And on 29 Sep 2011, at 18:04, Phil Petree wrote:
 This is an interesting problem... my first reaction is that you'd want to 
 use onComplete to update the div's instead of onSuccess.

 Test this with a couple of alerts and see which one gets called first and 
 which is last (just as onCreate is the first call, onComplete is the last).

 Well I had already tried onComplete and it made no difference, but I tried 
 your suggestion nevertheless and sure enough, wherever I put the alerts in 
 the code of the callbacks, onSuccess always emerged before onComplete. It 
 also didn’t matter (as I assumed it wouldn't) if I put the onComplete before 
 the onSuccess in the code.

 Then on 29 Sep 2011, at 18:28, Phil Petree wrote:
 This guy had a solution that worked for me:
 http://www.irt.org/script/416.htm

 I had already tried using the time in a similar way to this, but it didn’t 
 work. However, in the same message...

 I have also used the cheap trick of adding a random query string on to the 
 end of the image url:
 http://www.somedomain.com/images/newname.jpg?id=random_number and since this 
 will always generate a new url, the browser will refresh the image.

 That was the one! As I say, I thought I'd done that - or something very like 
 it - in my numerous attempts at different solutions, but I obviously didn’t 
 do exactly this, and it seems to work reliably every time in a suitably 
 bulletproof fashion. So simple!

 It also seems to confirm that my initial suspicions were correct, and it is 
 after all a caching issue, not to do with, er, asynchronicity (if that's a 
 word - if not, Ive just invented it, so there).

 So many thanks for your time and thoughts, Richard and Phil, also ncubica and 
 Walter for chipping in.

 --
 Cheers... Chris
 Highway 57 Web Development -- http://www.highway57.co.uk/

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



onFailure / onSuccess is in response to a working result from the AJAX call.

onComplete is in response to the AJAX mechanism shutting down.

onComplete will always be called, but it isn't its job to deal with
the data from the call. That is onSuccess. If the call failed for some
reason, onComplete wouldn't have any data to work with and could make
things worse.

I use onCreate and onComplete to turn on/off a little spinner showing
that the app is doing something behind the scenes.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Image cache problem with Ajax

2011-09-30 Thread Richard Quadling
On 30 September 2011 12:53, Chris Sansom ch...@highway57.co.uk wrote:
 On 30 Sep 2011, at 12:32, Richard Quadling wrote:

 onFailure / onSuccess is in response to a working result from the AJAX call.

 onComplete is in response to the AJAX mechanism shutting down.

 onComplete will always be called, but it isn't its job to deal with
 the data from the call. That is onSuccess. If the call failed for some
 reason, onComplete wouldn't have any data to work with and could make
 things worse.

 I use onCreate and onComplete to turn on/off a little spinner showing
 that the app is doing something behind the scenes.

 Right - thanks. That could be useful.

 --
 Cheers... Chris
 Highway 57 Web Development -- http://www.highway57.co.uk/

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



And if you use the Ajax.Responders
(http://api.prototypejs.org/ajax/Ajax/Responders/), you can define
that behaviour once for all of the ajax calls you make, rather than
having to add it to each individual ajax instance.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Image cache problem with Ajax

2011-09-30 Thread Richard Quadling
On 30 September 2011 13:09, Phil Petree phil.pet...@gmail.com wrote:
 I never meant to imply that onComplete did the same thing as onSuccess, what
 I meant to state was that onComplete ALWAYS gets called last.  onSuccess can
 always set a flag and onComplete can do the UI updates right before turning
 off the spinner.   This is useful if you're experiencing those
 asynchronicity problems that the OP thought he had...  Almost a poor mans
 semaphore manager.

I'd be wary of performing activities in onComplete which are based
upon results in onSuccess.

I've patched my Prototype to allow me to create a responder for any
callback (including statuses) as well as the ability for the
responders to block the local callback. Primarily this is for AJAX
error handling. I can return an appropriate status from the server, or
the request can fail (for something out side of my control) and all
the handling is done at the responder level. This makes my specific
AJAX calls much cleaner as they only need the onSuccess callback. This
mechanism works very well for me.




-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Image cache problem with Ajax

2011-09-29 Thread Richard Quadling
On 29 September 2011 15:00, Chris Sansom ch...@highway57.co.uk wrote:
 In sequence, this happens:
 -  User clicks image
 -  Ajax request is created, running a php script with various parameters, in 
 which...
 -  ...the necessary renaming takes place (which involves checking for 
 duplicates etc.), then...
 -  ...a php file is included* which does various processing to build up an 
 output string for the replacement div...
 -  ...in which all  are replaced by [] so as not to confuse the xml return.
 -  Back in JS, the [] are changed back to  and the containing div is 
 replaced.

Does ALL the JS work take place inside the onSuccess callback?


The Back in JS bit has to be part of the onSuccess callback
otherwise it will happen out of sequence. The A in AJAX is potentially
the hiccough here.

Regards,

Richard.
-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Image cache problem with Ajax

2011-09-29 Thread Richard Quadling
On 29 September 2011 16:58, Chris Sansom ch...@highway57.co.uk wrote:
 On 29 Sep 2011, at 15:51, Richard Quadling wrote:

 Does ALL the JS work take place inside the onSuccess callback?

 The Back in JS bit has to be part of the onSuccess callback
 otherwise it will happen out of sequence. The A in AJAX is potentially
 the hiccough here.

 That's what I suspected but yes, all the 'back in JS' stuff does indeed 
 happen in the onSuccess. (I also tried onComplete, but got the same result.) 
 I think the problem may be that the div, inevitably, is replaced right at the 
 end of the process (at the end of the onSuccess), and only then is the 
 offending img tag unleashed, calling either the image itself or my little 
 php script... but then I'd have thought preloading it might help, but it 
 doesn’t seem to. I also tried loading it via a php exec() call to the image 
 script in advance of returning the output string to JS, but that didn’t help.

 What also convinces me that you're right about the A in AJAX is that when, 
 for testing, I put a sleep(5) in the image script - which should hold it up 
 by a whole 5 seconds - the div is still replaced immediately. When I first 
 load the page (which also calls this script), I get a broken image icon where 
 the image should have been, replaced after 5 seconds by the image, but when 
 the div is replaced by the ajax call that doesn’t happen - I just get no 
 change of image as before.

 It really would be /so/ nice if I could get this working! It's for a 
 password-protected CMS, so the world at large will never get the benefit, and 
 I could simply reload the whole page instead of just the one div, but it's 
 become a challenge!

Create a test case where it goes wrong. Write new clean code that
doesn't want/need/use anything from the main project.

At best, this will be a small HTML page with some divs and images, a
JS file to allow the onclick to fire the AJAX code, along with the
onsuccess and the server side code to handle the request and to return
the new HTML markup.


Without seeing the server and client side code, you are going to be
stuck with a limited level of support.

If you can't reduce the problem to something that can be read, I doubt
anyone can realistically provide any more ideas on this.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Acceptable nicks(s) For Prototype.js

2011-09-12 Thread Richard Quadling
On 11 September 2011 12:06, kstubs kst...@gmail.com wrote:
 OK, what is it?  I hate saying proto-type-dot-j-s  So, not smooth.  Is it,
 proto-scripty?  I do a ton of stuff without the latter, so does anyone
 call it proto (wich sounds an awful lot like Frodo.
 Karl..

My cat's called Frodo.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [Proto-Scripty] Re: Prototype's evolution

2011-07-21 Thread Richard Quadling
On 20 July 2011 15:26, Sander Thalen stha...@gmail.com wrote:
 I also recently posted on the Lighthouse ticket system. But no response. I
 started writing about the documentation, but also mentioned that state of
 the community and the future. This is what I wrote:

 

 I have a question about the API Documentation that is generally available on
 the website of Prototype (and just a little more).

 The 'new' style documentation refers to the 1.7 documentation while the old
 one is (good as it is!) still available which Google is still indexing and I
 access it via my bookmarks. I try to use the new documentation now and then
 but for some reason I don't think it is nice to use. Also other developers
 tend to use the old one, over the new one.

 I really believe in the Prototype library - but I also notice that the
 jQuery (for example) community is growing larger and larger and less people
 seem to be interested in Prototype. It would be great if Prototype would
 become more popular, so that the community grows, which hopefully supports
 development as well. I think this can be achieved by adding a Forum on the
 website, that is easily accessibly. Of course I use the Mailing List as
 well, but a Forum would be an easy way to access. This is however not the
 most important addition I think.

 The amount of information in the Prototype API Documentation could use a
 little more.. documentation. This way more people can see how the full power
 and potential of Prototype can be unleashed and why this is such an
 interesting library.

 A good example of what I believe that is a good manual, is the PHP manual. A
 semi-fixed format where you can find all the required information to quickly
 use the specific class/function. Especially the Examples are very handy. I
 know the Prototype documentation has examples, but for this new function
 Element.Offset only a little amount of documentation is present - actually I
 don't know how to use it (yet).

 What are the plans for the documentation? Would it be possible to add
 examples myself? And also.. how does the Prototype team see the future
 regarding a community?

 If this sounds like a cry for help, well.. maybe it is. But not 100% for me,
 but for the entire community!

 Regards,
 Sander

 

As a member of the PHP Documentation team (an official title as PHP is
an Open Source Project and any one can contribute), I'd just like to
add my few pennies worth.

1 - The PHP documentation is stored as DocBook 5 XML - http://www.docbook.org/
2 - The documentation is stored on a SubVersion server -
http://svn.php.net/viewvc/phpdoc/
3 - We have many translations, some undertaken by a handful of people.
4 - We have an online editing facility, allowing unregistered users to
correct/enhance the manual, with their changes being verified by an
existing member of the team - https://edit.php.net/
5 - We also allow unregistered users to add notes to the manual. These
aren't directly part of the official documentation, but can still be
present within the online manual, and in offline Windows CHM files -
http://www.php.net/download-docs.php
6 - You can become a member when the quality of your changes are
acknowledged and supported by other members - a meritocracy.
7 - All of this may be overkill for Prototype.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Sortable with 1,000 elements?

2011-07-04 Thread Richard Quadling
On 30 June 2011 17:33, Walter Lee Davis wa...@wdstudio.com wrote:

 On Jun 30, 2011, at 12:08 PM, Richard Quadling wrote:


 I use http://www.kryogenix.org/code/browser/sorttable/
 -- Richard Quadling
 Twitter : EE : Zend : PHPDoc
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea


 Thanks, that's completely a different thing from what I'm doing. I have a
 drag-to-sort widget that lets users put photos in a specific order, then
 saves that order in an Ajax callback. Scripty.Sortable does precisely that.

 Walter

Aha! Ok. Sorry for the noise.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
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] Sortable with 1,000 elements?

2011-06-30 Thread Richard Quadling
On 30 June 2011 15:41, Walter Lee Davis wa...@wdstudio.com wrote:
 Thanks very much for the offer. I seem to have fixed it here, but the
 problem wasn't specifically in Sortable. What I ended up doing was
 staggering some of the Ajax loading events that were also happening while
 that function fired using setTimeout and that got around the problem.

 Somewhere on one of my computers I have a copy of a framework called light
 sortable or lite sortable, which aims to ape the Scriptaculous API without
 being so heavy. It eschews the fancy animation effects for simple fast drag
 sorting. But my page (and client) are pretty wedded to that eye candy, so I
 guess Im stuck with that.

 Thanks,

 Walter

 On Jun 30, 2011, at 10:23 AM, Phil Petree wrote:

 Walter,

 I had the timeout problem on a script with a different purpose.  What I
 did was hijacked the code here:
 http://www.mcfedries.com/JavaScript/timer.asp

 I created an array: var  funcTimers[]  and then modified the above code to
 insert into the array and each func started the timer on entry and ended it
 on exit.

 At the end, I dumped the funcTimers out with an alert() and I had my
 answer.

 Also, about 10 years ago (when I was younger and smarter) I wrote a table
 sort function that would sort a standard html table based on the column
 clicked.  It was quite fast and would sort through 1000 columns pretty
 quickly.  I looked on my backup drive and couldnt find it but if you want,
 I'll root around and post it might give you a different strategy.

 P~

 On Thu, Jun 30, 2011 at 9:01 AM, Walter Lee Davis wa...@wdstudio.com
 wrote:
 I have been chasing my tail on a slow script error, and just now
 discovered that if I disable my call to make a 1,000 element list sortable
 the problem goes entirely away.

 First, is there any sort of tool I can use to determine where this
 function is spending all of its time?

 Second, is there any way to get around these slow script errors? The issue
 I am seeing is that once the page loads, and this function is called, the
 browser goes into beachball mode, eventually shows an alert about the slow
 script. If I okay that (keep trying, I tell it) the page loads and works
 perfectly. Sortable does exactly what it's supposed to do, and very
 snappily.

 Thanks in advance,

 Walter

I use http://www.kryogenix.org/code/browser/sorttable/
-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: 答复: [Proto-Scripty] Re: problem in Event.observe()

2011-06-09 Thread Richard Quadling
On 8 June 2011 14:31, ColinFine colin.f...@pace.com wrote:


 On Jun 7, 8:05 am, 操坤 madfro...@gmail.com wrote:
 Hi:
         Sorry for my poor English  :P
         I know your meaning of your reply:

 I did a simple test:

         test=function(){
                 alert(11);
         }
         Event.observe(window,load,test);

 The above is correct.

         function test2(){
                 alert(2);
         }
         Event.observe(window,load,test2());

 The above is wrong.

I think

 Event.observe(window,load,test2);

would be OK too.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [Proto-Scripty] Re: strange element.select issue

2011-04-04 Thread Richard Quadling
On 3 April 2011 20:14, Joschi Cassel josch...@gmail.com wrote:
 I do recall that now.  Thank you.  It just fits so perfectly to use
 the ID of the sql table row as the ID of the matching HTML table
 row :)  What is your preferred method when populating a table with
 results from a query?

 Thank you,
 Joschi


If I'm building a table to hold multiple rows, then I don't use IDs at
all as the IDs will change for every row/page being viewed, so all the
build-up/tear-down for every pagination would seem to be redundant.

Instead, I'd code the client to rely on bubbled events so that I only
need to add 1 event to the container that won't change for each
pagination.

My input tag names would be along the lines of ...

name=tableName[id][column1Name]

That way, when they get to PHP, I have a nested array of data which
matches the structure of the data I would need to insert into the DB
as well as the structure of the data I would get from the DB.

So, 1 pattern of coding logic.

foreach($_POST['tableName'] as $i_ID = $a_Row) {
  // Validate data
  // $i_ID === int  0
  // $a_Row['column1Name'] === string / regex / etc.

  // Process row.
}


Sort of thing.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Why is there a $super-Parameter?

2011-03-18 Thread Richard Quadling
On 18 March 2011 11:43, Luke kickingje...@gmail.com wrote:
 Hi,
 I'm working on my bachelor-thesis and I'm trying to understand a few things.
 I'm wondering: Why is there the construct of the $super-parameter in
 Prototype's class-implementation? Is anything wrong with calling
 this.parent.myfunction()? Why did they implement that?
 This is more of a theoretical question.. I just think there must be a reason
 for the $super thing..
 Does anyone have an idea?
 Thanks
 Lukas

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


parent relates to the DOM which is an object orientated model.

Javascript classes are not OOP, but prototypes. As such parent is
not appropriate.

To simulate parent in PrototypeJS, $super was defined.

http://prototypejs.org/learn/class-inheritance

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Rails 3.1 - Prototype = WTF?

2011-03-16 Thread Richard Quadling
On 15 March 2011 18:49, Felix felix1...@gmail.com wrote:
 What must Prototype JS do to become the library of choice?

PrototypeJS _is_ my library of choice.

Job done! Well done PrototypeJS Core-Devs.

And you can quote me on that!

Ha. I wonder how much I'd have to pay so that I could get ...

ProtoypeJS is Richard Quadling's library of choice. Make it yours today!

on the front page.

I've got chocolate and beer. Probably can also get chocolate flavoured
beer if necessary!

Richard.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: event on leaving page

2011-03-11 Thread Richard Quadling
On 11 March 2011 01:17, joe t. thooke...@gmail.com wrote:
 One note on TJ's post, hopefully helpful:

 You cannot CANCEL the unload event. If i understand them correctly,
 load and unload are the only native events that can't be canceled from
 scripts. You can perform other actions, but unload means the browser
 has been committed to unloading that page, regardless what else it's
 told to do at that point. The point of no return to let the user
 cancel the unload is beforeunload (handy, and a Microsoft creation,
 ironically).

 And to his point, he's correct: about the only other actions you can
 take are cleanup/garbage collection. Not that it would matter anyway
 if you create new content, the page is going bye-bye. :)

 That all comes from a painful two weeks a few years ago before i knew
 about beforeunload. Still bitter at myself over that.
 -joe t.


 On Mar 10, 9:31 am, Walter Lee Davis wa...@wdstudio.com wrote:
 On Mar 10, 2011, at 2:25 AM, T.J. Crowder wrote:

  What you can do in those functions is severely limited by modern
  browsers (for all the good reasons you can think of). You can't open
  new windows, do alerts/confirms

 Thanks. This is the part I was remembering -- someone wanted an Are
 You Sure to interrupt closing the window on a running process, and I
 mistook the answer to mean that onunload couldn't do much of anything,
 versus 'couldn't do much of anything to the current window'. That
 makes perfect sense now.

 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.



Sort of related, is there a way to see ALL the events being fired by
the DOM? I used to use Borland tools on Windows and one of the tools
was a message inspector. You could target an app and watch the
messages being passed around - there were a LOT - Windows is really
chatty.

Is there a global event dispatcher that can be hooked into?

If so, how useful would this be in diagnosing issues and seeing what
events the browsers support and how the events are called?

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Limited toggle effect?

2011-02-21 Thread Richard Quadling
On 20 February 2011 14:21, jeremy jereme...@gmail.com wrote:
 Hey everybody,

 I want to apply a scriptaculous toggle effect to a div, but I do not
 want the effect to impact the full div...

 I try to be a bit clearer :

 I have a div, with a variable height of, let's say, for example,
 1000px.
 I want the div to be half-hidden : when the page is loaded I want to
 see a 400px height
 Then I click on a link show the full div, and the hidden 600px are
 shown

 It would be quite simple with 2 divs, one of 400px and one of 600px
 with a toggle effect - but I MUST use one unique div

 Is it possible?

 Thank you VERY MUCH for your help.

 Jeremy


A top-of-my-head suggestion  ...

Rather than toggling visibility, how about 2 CSS classes?

The first class (and the one assigned to the div in the HTML) would
reflect the initial state.

An onclick handler could then use an addClass() to add in the CSS
class that reflects the full height.

I guess the second CSS class would have ...

height:inherit;

maybe.






-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Strange ajax behaviour with effect.morph

2011-01-27 Thread Richard Quadling
On 27 January 2011 13:47, Luke kickingje...@gmail.com wrote:
 Hi Rey,
 you shouldn't use timers for this - you canot be sure when an ajaxrequest
 has finished loading. There are parameters both in the ajax-methods and in
 morph that take functions that will be called on a specific event like when
 the ajax-call has been loaded (these are called callbacks).
 Check http://www.prototypejs.org/api/ajax/options section Common callbacks
 and http://madrobby.github.com/scriptaculous/core-effects/ for the part
 callbacks.
 A simple usage would be
 new Effect.Morph( myDiv, { style:height:0px;,
   afterFinish: function({
     new Ajax.Request(url, {
       onSuccess: function(transport) {
         new Effect.Morph( myDiv, { style:height: 222px;overflow:hidden;
 } );
       }
     });
   })}
 );

 There might be syntax-errors in this

If you ALWAYS want the morph to occur, even after a failure with the
AJAX call, the I would recommend using onComplete.

Read about the Common Callbacks on http://api.prototypejs.org/ajax/

onComplete: Triggered at the very end of a request's life-cycle, after
the request completes, status-specific callbacks are called, and
possible automatic behaviors are processed. Guaranteed to run
regardless of what happened during the request.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Is there a way to insert a template-based element and retain a reference to it at once?

2011-01-25 Thread Richard Quadling
On 25 January 2011 16:15, Walter Lee Davis wa...@wdstudio.com wrote:
 I've done the following a lot in a piece of code I'm working on:

 var t = new Template('div id=id_#{num}.../div');
 $R(1,4).each(function(n){
        $('page').insert(t.evaluate({num:n}));
        //and then I need to add some extras to that div
        //so I end up doing this to get a handle on it
        $('id_' + n ).doSomethingElse();
 });

 Is there another way to return a reference to a new template-based element so 
 I don't have to do a find by ID (and worry about browsers' lag times in 
 recognizing new DOM objects)?

 I can obviously just to this:

 var newElement = new Element('div',{id:'id_' + n});

 and I have done so in a few other places, but Templates are so nice and clean 
 and reduce the concatenation to a minimum. (Plus, this is a cut-down example 
 and the real thing is much more complex.) It would be nice if insert could 
 return an object reference to the object created, rather than the object that 
 you're inserting into, or if Template could refer somehow to the object 
 created rather than just the string that will define it once it's inserted in 
 another element.

 Walter

Template.evaluate doesn't create an object, just a string, so there is
no way to maintain a reference to anything. Only if you insert the
string into the DOM does it become capable of having a reference.

var ref = $('page').insert(...);

But as you are calling this in a loop (essentially), you will need to
generate an array of refs.

ref[n] = $('page').insert(...);

Maybe.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Is there a way to DRY this up?

2010-12-23 Thread Richard Quadling
On 22 December 2010 18:16, Walter Lee Davis wa...@wdstudio.com wrote:
 I have a quick filter for hiding list items until only matches show. I want
 to cover all the various ways that a user might interact with the search
 field, so I write this lovely:

        $('filter').observe('keyup', function(evt){
                this.fire('check:filter');
        });
        $('filter').observe('click', function(evt){
                this.fire('check:filter');
        });
        $('filter').observe('focus', function(evt){
                this.fire('check:filter');
        });
        $('filter').observe('blur', function(evt){
                this.fire('check:filter');
        });

 Is there any way to write this more clearly, as in with fewer lines of code?

 I'm using 1.6.latest, haven't tried the new 1.7 goodies yet. Would that
 help?

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



Maybe something like ...

['keyup', 'click', 'focus', 'blur'].each(function(eventName){
 $('filter').observe(eventName, function(evt){
  this.fire('check:filter');
 });
});


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Is there a way to DRY this up?

2010-12-23 Thread Richard Quadling
@TJ

Yeah. I sort of noticed that.

I like the observeAll mechanism. Very reusable.

In PHP, I could ...

if (!!fn || fn = function(){...}) {
 fn();
}

sort of thing. Basically assign a value to a variable and evaluate the
assignment. For closures, this is always true.

Could this be done in JS?



On 23 December 2010 15:21, T.J. Crowder t...@crowdersoftware.com wrote:
 @Richard:

 Maybe something like ...

 ['keyup', 'click', 'focus', 'blur'].each(function(eventName){
  $('filter').observe(eventName, function(evt){
   this.fire('check:filter');
  });

 });

 That creates four identical functions (one for each event). Not
 necessarily a problem, but...

 @Walter: How 'bout *really* not repeating yourself: ;-)

 // In your bag of tricks
 Element.addMethods({
    observeAll: function(element, eventNames, handler) {
        if (!(element = $(element))) return;
        eventNames = typeof eventNames === string ? $w(eventNames) :
 eventNames;
        eventNames.each(function(eventName) {
            Event.observe(element, eventName, handler);
        });
        return element;
    }
 });

 // Then in this specific case:
 $('filter').observeAll(['keyup', 'click', 'focus', 'blur'],
 function(evt) {
   this.fire('check:filter');
 });

 // Or:
 $('filter').observeAll('keyup click focus blur', function(evt) {
   this.fire('check:filter');
 });

 // Or even:
 var filter = $('filter');
 filter.observeAll(
   'keyup click focus blur',
   Element.fire.curry(filter, 'check:filter'));

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

 On Dec 23, 10:02 am, Richard Quadling rquadl...@gmail.com wrote:
 On 22 December 2010 18:16, Walter Lee Davis wa...@wdstudio.com wrote:









  I have a quick filter for hiding list items until only matches show. I want
  to cover all the various ways that a user might interact with the search
  field, so I write this lovely:

         $('filter').observe('keyup', function(evt){
                 this.fire('check:filter');
         });
         $('filter').observe('click', function(evt){
                 this.fire('check:filter');
         });
         $('filter').observe('focus', function(evt){
                 this.fire('check:filter');
         });
         $('filter').observe('blur', function(evt){
                 this.fire('check:filter');
         });

  Is there any way to write this more clearly, as in with fewer lines of 
  code?

  I'm using 1.6.latest, haven't tried the new 1.7 goodies yet. Would that
  help?

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

 Maybe something like ...

 ['keyup', 'click', 'focus', 'blur'].each(function(eventName){
  $('filter').observe(eventName, function(evt){
   this.fire('check:filter');
  });

 });

 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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





-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 08:32, Luke kickingje...@gmail.com wrote:
 Hi Richard,

 thanks for your reply. With

 The return is something I've been using since May 2008 with all the
 releases and updates since then.

 Do you mean you have used the native prototype-return, or did you
 alter it, and it still worked?

 On Dec 16, 6:04 pm, Richard Quadling rquadl...@gmail.com wrote:
 On 16 December 2010 16:36, Luke kickingje...@gmail.com wrote:





  Hi,

  if you define a Class like

  --
  var TestClass = Class.create({
         initialize: function(element) {
                 element = $(element);
                 this.doFunkyStuffWithElement(element)
                 return element;
         },
         doFunkyStuffWithElement: function(element) { log(funky stuff
  here) }
  });
  --

  and you instantiate that Class

  var myObject = new TestClass();

  is there a way I can change it so (while namespacing my Class-Code so
  Prototype's Class will remain untouched) that instantiation of that
  class will return something different than what Prototype returns (in
  my case a DOM-Object that has been extended with custom Methods)?

  ---
  Why I want to do this: I'm working on a site where you can create
  really simple webpages by adding, editing, and removing elements on
  your page. To structure my code I make use of prototype's dom-
  extending nature and its way of class-inheritance:
  There is a base class for elements on the page which has methods for
  editing and removing that object and so on. I subclass this base-class
  for specific elements where I implement the specific editing/removing/
  whatever-code. Now to map my functionality to the elements on the
  page, I extend the DOM-Elements which you can edit/etc with the
  methods and properties of the class, leaving out unnecessary
  constructors etc.

  But it is always a little annoying to extend an object with a class,
  and then fetch that object again to work with it:

  --
  new EditablePicture($('the_element_I_extend'));
  var my_element = $('the_element_I_extend');
  my_element.do_something();
  --

  it would be nice to be able to do something like this:

  --
  var my_element = new EditablePicture($('the_element_I_extend'));
  my_element.do_something();
  --

  Is that kind of stuff even possible?

  Thank you
  Lukas

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

 Yep - I think so. Look at around line 80 of prototype.js

     function klass() {
       return this.initialize.apply(this, arguments);
     }

 The return is something I've been using since May 2008 with all the
 releases and updates since then.

 I've not had any issues with my code or with scripty with it.

 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



I build my own prototype. I have a patch which is applied to after the
compiled from source.

So, any class I create, I can return something from the initializer.

I'm trying to find the original request for this feature, but I can't.
It makes my classes work like a Factory if the initializer returns
something other than this.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 08:32, Luke kickingje...@gmail.com wrote:
 Hi Richard,

 thanks for your reply. With

 The return is something I've been using since May 2008 with all the
 releases and updates since then.

 Do you mean you have used the native prototype-return, or did you
 alter it, and it still worked?

 On Dec 16, 6:04 pm, Richard Quadling rquadl...@gmail.com wrote:
 On 16 December 2010 16:36, Luke kickingje...@gmail.com wrote:





  Hi,

  if you define a Class like

  --
  var TestClass = Class.create({
         initialize: function(element) {
                 element = $(element);
                 this.doFunkyStuffWithElement(element)
                 return element;
         },
         doFunkyStuffWithElement: function(element) { log(funky stuff
  here) }
  });
  --

  and you instantiate that Class

  var myObject = new TestClass();

  is there a way I can change it so (while namespacing my Class-Code so
  Prototype's Class will remain untouched) that instantiation of that
  class will return something different than what Prototype returns (in
  my case a DOM-Object that has been extended with custom Methods)?

  ---
  Why I want to do this: I'm working on a site where you can create
  really simple webpages by adding, editing, and removing elements on
  your page. To structure my code I make use of prototype's dom-
  extending nature and its way of class-inheritance:
  There is a base class for elements on the page which has methods for
  editing and removing that object and so on. I subclass this base-class
  for specific elements where I implement the specific editing/removing/
  whatever-code. Now to map my functionality to the elements on the
  page, I extend the DOM-Elements which you can edit/etc with the
  methods and properties of the class, leaving out unnecessary
  constructors etc.

  But it is always a little annoying to extend an object with a class,
  and then fetch that object again to work with it:

  --
  new EditablePicture($('the_element_I_extend'));
  var my_element = $('the_element_I_extend');
  my_element.do_something();
  --

  it would be nice to be able to do something like this:

  --
  var my_element = new EditablePicture($('the_element_I_extend'));
  my_element.do_something();
  --

  Is that kind of stuff even possible?

  Thank you
  Lukas

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

 Yep - I think so. Look at around line 80 of prototype.js

     function klass() {
       return this.initialize.apply(this, arguments);
     }

 The return is something I've been using since May 2008 with all the
 releases and updates since then.

 I've not had any issues with my code or with scripty with it.

 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Simply adding return to the call to the this.initialize.appy(this,
arguments); should be enough.

Having to do this for each release is a bit of a pain, and I can't see
why this isn't supported as standard.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 10:14, Luke kickingje...@gmail.com wrote:
 Sounds good. Can you post a link to your source (if you want to share
 it and have it on github or something)?

I don't use github. I simply build prototype and then add my patch.

I don't have any unit tests for this either, but my users are using it
all day every day (24 hour call centre) for several years.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Can I change what new [someClass] will return?

2010-12-16 Thread Richard Quadling
On 16 December 2010 16:36, Luke kickingje...@gmail.com wrote:
 Hi,

 if you define a Class like

 --
 var TestClass = Class.create({
        initialize: function(element) {
                element = $(element);
                this.doFunkyStuffWithElement(element)
                return element;
        },
        doFunkyStuffWithElement: function(element) { log(funky stuff
 here) }
 });
 --

 and you instantiate that Class

 var myObject = new TestClass();

 is there a way I can change it so (while namespacing my Class-Code so
 Prototype's Class will remain untouched) that instantiation of that
 class will return something different than what Prototype returns (in
 my case a DOM-Object that has been extended with custom Methods)?


 ---
 Why I want to do this: I'm working on a site where you can create
 really simple webpages by adding, editing, and removing elements on
 your page. To structure my code I make use of prototype's dom-
 extending nature and its way of class-inheritance:
 There is a base class for elements on the page which has methods for
 editing and removing that object and so on. I subclass this base-class
 for specific elements where I implement the specific editing/removing/
 whatever-code. Now to map my functionality to the elements on the
 page, I extend the DOM-Elements which you can edit/etc with the
 methods and properties of the class, leaving out unnecessary
 constructors etc.

 But it is always a little annoying to extend an object with a class,
 and then fetch that object again to work with it:

 --
 new EditablePicture($('the_element_I_extend'));
 var my_element = $('the_element_I_extend');
 my_element.do_something();
 --

 it would be nice to be able to do something like this:

 --
 var my_element = new EditablePicture($('the_element_I_extend'));
 my_element.do_something();
 --

 Is that kind of stuff even possible?

 Thank you
 Lukas

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



Yep - I think so. Look at around line 80 of prototype.js

function klass() {
  return this.initialize.apply(this, arguments);
}

The return is something I've been using since May 2008 with all the
releases and updates since then.

I've not had any issues with my code or with scripty with it.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Infinite references

2010-12-09 Thread Richard Quadling
On 9 December 2010 09:27, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 The problem is that your `childs` property is shared by all of your
 instances, it's not specific to each instance. You have the same
 problem that the OP has in this question from just a few days ago, so
 see that thread for the details of why:
 http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/85114620db0bdc0e

 You can fix it by removing the `childs: [],` line from your
 `Class.create` call and then adding:

    this.childs = [];

 ...in your `initialize` function. That will ensure that each instance
 has its own array.

 (Off-topic: In English, the plural of child is children, not
 childs. Although most English nouns are made plural by adding an s
 or es or even ses, quite a number of them are done differently.)

 Hope this helps,
 --
 T.J. Crowder
 Independent Software Engineer
 tj / crowder software / com
 www / crowder software / com

 On Dec 8, 2:05 pm, Bart bblok...@gmail.com wrote:
 Hi,

 I'm creating a visual tree structure in which every item can have
 multiple childs. In the following code the parent item adds one child
 to itself. But for some reason the child adds itself as a child of its
 own in an infinite loop:

 - CODE --
 var Item = Class.create({

             column: null,
             text: null,
             childs: [],
             parent: null,

             initialize: function(column, text, parent)
             {
                 this.column = column;
                 this.text = text;
                 this.parent = parent;

             },

             addChild: function(child)
             {
                 this.childs[this.childs.length] = child;
             }

         });

 var startI = new Item(1, 'start', null);
 var vervolg1 = new Item(2, 'vervolg 1', startI);
 var vervolg2 = new Item(2, 'vervolg 2', startI);

 startI.addChild(vervolg1);
 startI.addChild(vervolg2);
 -

 You can find an image of the result (in the console) 
 onhttp://www.bartblok.com/problem.PNG
 Why is this an infinite reference? The code should add vervolg1 and
 vervolg2 as childs of startI, but not childs of themselves.

 I hope someone can help me :)

http://pastebin.com/gZ97fiH7 shows the fix T.J. is recommending.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] finding absolute position of an element

2010-12-07 Thread Richard Quadling
On 7 December 2010 15:34, doug douglass_da...@earthlink.net wrote:


 From searching and looking at the API docs, doesn't look like
 prototype is able to do this, but I thought I would ask anyway in case
 some one has an idea.

 I have a generic form generator library and in the forms generated, I
 need to be able to absolutely position a help div next to an image
 of a question mark.

 I need this to work in the following cases:

 1. the form is on a page by itself
 2. the form is in a lightbox (which is absolutely positioned)
 3. the form is in a scrollable div on a page by itself
 4. the form is in a scrollable div INSIDE a lightbox (which is also
 scrollable)

 Basically, this requires me find a uniform way to get the absolute
 position of the question mark image.

 positionedOffset works for 1 and 2.  For 4 I have to use
 positionedOffset along with cumulativeScrollOffset and do some math.
 Is there a way to get the absolute position no matter which one of
 these cases?

 thanks.

I think http://api.prototypejs.org/dom/Element/Layout/ may answer your
questions.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: finding absolute position of an element

2010-12-07 Thread Richard Quadling
On 7 December 2010 16:17, doug douglass_da...@earthlink.net wrote:


 On Dec 7, 10:58 am, Richard Quadling rquadl...@gmail.com wrote:
 On 7 December 2010 15:34, doug douglass_da...@earthlink.net wrote:





  From searching and looking at the API docs, doesn't look like
  prototype is able to do this, but I thought I would ask anyway in case
  some one has an idea.

  I have a generic form generator library and in the forms generated, I
  need to be able to absolutely position a help div next to an image
  of a question mark.

  I need this to work in the following cases:

  1. the form is on a page by itself
  2. the form is in a lightbox (which is absolutely positioned)
  3. the form is in a scrollable div on a page by itself
  4. the form is in a scrollable div INSIDE a lightbox (which is also
  scrollable)

  Basically, this requires me find a uniform way to get the absolute
  position of the question mark image.

  positionedOffset works for 1 and 2.  For 4 I have to use
  positionedOffset along with cumulativeScrollOffset and do some math.
  Is there a way to get the absolute position no matter which one of
  these cases?

  thanks.

 I thinkhttp://api.prototypejs.org/dom/Element/Layout/may answer your
 questions.

 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

 I looked at this, but I'm not sure how this would allow me to get the
 position of an element.  Can you elaborate?

 Also, one more thing I didn't mention. With the absolutely positioned
 lightbox, it is acceptable that I get the position of the element with
 respect to the lightbox.  Although if I can get it with respect to the
 entire page, that would be fine too.

var layout = new Element.Layout('myLightBoxID');
var left = layout.get('left');

for example.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: Risky delay (was: Re: [Proto-Scripty] Re: Prototype / IE6 issue (bug?))

2010-11-17 Thread Richard Quadling
On 17 November 2010 14:43, Phil Petree phil.pet...@gmail.com wrote:
 I know there are exceptions to every rule... and I have been in your shoes
 (supporting users on platforms that are no longer supported) and its a tough
 walk.


 On Wed, Nov 17, 2010 at 9:13 AM, matt.asbury matt.asb...@gmail.com wrote:

 I appreciate your standpoint Phil but as web developers we must
 support our users needs. Unfortunately our biggest customers are
 public sector workers with the major browser in their environment
 being IE6. Online figures tell half a story

 On Nov 17, 2:07 pm, Phil Petree phil.pet...@gmail.com wrote:
  There comes a time in every products life cycle when you must choose
  which
  core products (e.g. browsers etc.) and platforms you will support.
 
  In the case of ie6, with less than 5% of all page views (and rapidly
  declining), it is now a footnote so why support it at all?
 
  stats here:http://mashable.com/2010/06/01/ie6-below-5-percent/
 
  This be-all-to-all strategy simply doesn't work.  You can't possibly
  support
  all versions of all browsers without causing a horrible and
  unpredictable
  experience for users.
  On Wed, Nov 17, 2010 at 7:40 AM, Bertilo Wennergren
  berti...@gmail.comwrote:
   On Wed, Nov 17, 2010 at 09:01, petrob petrob...@yahoo.com wrote:
 
Why don't you put the evaluation part in a separate function within
the scope of handleVehiclesClick and call it with some delay (100ms)
to decide what and how many option elements  to select?
 
   That is of course a common solution to such problems, and I use it
   myself a lot, but I always have a nagging worry in the back of my
   head: Is that really a clean and safe method?  I pick a delay time,
   e.g. 100ms, out of thin air and then test if it works ... for me, in
   my browsers, in my computer, today, here. But will that be so for
   every user everywhere? Perhaps those 100ms will not be enough for
   someone using an old computer with MSIE6, or on a computer with lots
   of malware that sucks all the resources, or for someone who is
   compiling the Linux kernel while browsing, or... So maybe 500ms, or
   1000ms, or... How do we test? How do we make sure?
 
   There must be a better way. Or not?
 
   Nothing to do with Prototype or scriptaculous, I know, but still...

I've been in this exact situation.

And the way I handled this was to say that the due to the limitations
and capabilities of IE6, the more interactive features prevalent on
modern websites were simply not economically viable to implement.

Basically IE6 development costs at least twice as much as IE8, in
terms of development time and hacking workarounds. AND there is no
guarantee that once the code is running on IE6 that it will work on
any other browser, not without even more development time (and
therefore money). Tell them that by providing a standard/simple HTML
page you are saving them considerable amounts of money in terms of
development costs and support issues.

So, sure, provide them with a normal, non-interactive site that
fulfils the business requirement. Just don't add any bells and
whistles.

If you do this AND can provide a working site, you'll probably keep
the contract AND be the first they'll talk to when/if they do upgrade.

Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Ajax and screen readers

2010-11-09 Thread Richard Quadling
On 8 November 2010 17:32, Walter Lee Davis wa...@wdstudio.com wrote:
 Has anyone on this list built a site that used Ajax partial page replacement
 techniques that also needed to be visible to a screen reader? How did you
 go about it?

 I'm developing a telemedicine system, and it occurs to me that there may be
 Federal funding involved somewhere and thus a requirement that the interface
 be accessible to visually-disabled persons.

 Walter

http://juicystudio.com/displayarticle.php/making-ajax-work-with-screen-readers.php?page=making-ajax-work-with-screen-readers.php

If you think along the lines of what do I have to do to my code so
that it works on IE4?, then you'll probably have the right mindset to
get your code working on all the different assistive technology
products.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Prototype and change event

2010-11-08 Thread Richard Quadling
On 8 November 2010 07:30, pyromaniac kinwiz...@gmail.com wrote:
 Hi. Everybody knows that onchange event don't work in ie 6-8 properly.
 Also, jquery and rightjs have special wrappers for this event. And i
 didn't find this feature for prototype. Please, tell me, where can i
 find such plugin? Or i must write it by myself?

 Thanks.

The Event class is provided by Prototype. The Event.observe method is
used to attach code to events.

See http://api.prototypejs.org/dom/event/observe/

Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Mousewheel on a select.

2010-10-05 Thread Richard Quadling
Hi.

Having just found an issue on a site saying that we can use the
mousewheel on the select tag to move up/down the options and found
it not working, I created a test page.

http://pastie.org/1200711

Enjoy!

Regards,

Richard.

function MouseWheelHandler(ev)
{
// Determine the direction of the wheel.
// For the sake of brevity, left/right wheels work like up/down.
var i_Delta = Math.max(-1, Math.min(1, !!ev.detail ? ev.detail * -1 :
ev.wheelDelta));

// Only process actual changes.
if (0 != i_Delta)
{
// Shortcut to the select tag.
var el_Select = ev.findElement('select');

// Only process actual changes on select tags.
if (!!el_Select)
{
// Number of options (used to wrap or limit the 
scrolling).
var i_Options = el_Select.options.length;

// You can use the line below to cause the select to 
wrap around.
var i_NewIndex = (el_Select.selectedIndex +
el_Select.options.length + i_Delta) % i_Options;

// Or you can use the lines below to not wrap around.
var i_NewIndex = Math.max(0, Math.min(i_Options - 1,
el_Select.selectedIndex + i_Delta));

// Set the new index.
el_Select.selectedIndex = i_NewIndex;

// Don't bubble the event so the page shouldn't move.
ev.stop();
}
}
}

document
.observe
(
'dom:loaded',  // Wait until the document is ready.
function()
{
// Tell all the selects to watch for 
mousewheel/DOMMouseScroll events.
$$('select')
.invoke('observe', 'mousewheel', 
MouseWheelHandler) //
Google Chrome. Will also override normal behaviour for IE, so wrapping
is now functional on IE.
.invoke('observe', 'DOMMouseScroll', 
MouseWheelHandler); // Firefox
}
);

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Microsoft announced new useful plugins on JQuery - what about prototype?

2010-10-05 Thread Richard Quadling
On 5 October 2010 15:14, buda www...@pochta.ru wrote:
 http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-data-link-and-globalization-accepted-as-official-jquery-plugins.aspx

 This is very useful - this must be in prototype too!

So I've backed the wrong horse. Again!

I'm glad I'm not a gambling man.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] AJAX callbacks are not executed atomically?

2010-09-25 Thread Richard Quadling
On 24 September 2010 20:21, JoJo tokyot...@gmail.com wrote:
 I have several lines of code that I want to run atomically (no context
 switches to other code). Please look at the following barebones
 example that illustrates the issue:

 //=

 function doAjax() {
  console.info('making request');
  new Ajax.Request(
  url, {
   onSuccess: function() {
     console.info('success');
   },
   onFailure: function() {
    console.info('failure');
   },
   onComplete: function() {
    console.info('complete');
   }
  }
  );
 }

 doAjax();
 doAjax();

 //=

 If the processor is faster than the network, I expect the output to
 be :

 making request
 making request
 success
 complete
 success
 complete

 However, under certain conditions, success+complete is sometimes not
 atomic. Here's some output that I have seen:

 (A) making request
 (A) success
 (B) making request
 (A) complete
 (B) success
 (B) complete

 This is against my expectations and breaks my code logic - the website
 fails to function when complete does not IMMEDIATELY follow success.
 Can someone shed some light on why this is happening? I thought AJAX
 is only asynchronous while waiting for the server and should become
 synchronous as it's executing the callback 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.



Don't do 2 requests.

Make 1 request and get both sets of data from the server at the same time.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Strange issue with Google Chrome, zoomed out page and margin-box-width.

2010-09-22 Thread Richard Quadling
Hi.

I'm using Google Chrome V7.0.517.8 dev, FireFox V3.6.10, IE8 and
Prototype V1.7RC2.

The code I'm using has a LOT of documentation and a page to show what
is going on.

The code is available at http://pastebin.com/9qGsR5ub.

You should be able to cut and paste to a file, edit the location of
your prototype V1.7RC2 and run it.

So. What is happening to me.

If I load the page in any of the browsers at 100% zoom and click on
steps 1, 2 and 3 and then look at the stats page, then everything
works.

Specifically, on the stats page, I see ...

i_preLabelHeight16  a_Labels.invoke('getHeight').max()  The 
largest
height of the labels
i_preLabelWidth 170 a_Labels.invoke('getWidth').max()   The largest
width of the labels
...
#cbGridContainer label  height : 16px; width : 170px;
...
i_postLabelHeight   20  
a_Labels.first().getLayout().get('margin-box-height')   The
height of the labels after resizing
i_postLabelWidth170 
a_Labels.first().getLayout().get('margin-box-width')The
width of the labels after resizing



You can run through all the steps at 100% and it all works for me.

It isn't the fastest code yet.

Now using IE or FF, I can zoom out (making the text smaller) and
refresh the page and it still works, all the way down to the largest
zoom level. On IE, it gets VERY small.

Using Google Chrome though, I get a really odd event.

At 100% all fine.

Press [CTRL]+[-] to zoom out. [F5] to refresh. Click on Steps 1, 2 3
and then look at the stats.

I then see ...

i_preLabelHeight17  a_Labels.invoke('getHeight').max()  The 
largest
height of the labels
i_preLabelWidth 172 a_Labels.invoke('getWidth').max()   The largest
width of the labels
...
#cbGridContainer label  height : 17px; width : 172px;
...
i_postLabelHeight   19  
a_Labels.first().getLayout().get('margin-box-height')   The
height of the labels after resizing
i_postLabelWidth171 
a_Labels.first().getLayout().get('margin-box-width')The
width of the labels after resizing


The margin-box-width is actually smaller than the original width.

So. Start again. Choose a zoom level. F5 and then choose all steps.

At different zoom levels, the grid will not be right.

The calculations which work at 100% for chrome and all levels in IE/FF
will be out.

It seems that the margin-box-width isn't accurate when zooming in Chrome.


Can anyone take a look?

Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Execute a function after another one

2010-09-22 Thread Richard Quadling
On 22 September 2010 12:50, Kupido kup...@hotmail.com wrote:
 Hello,
 I'm looking for a reliable way to call a function after the previous
 one has completed.

 I'm not new to Prototype but I can't find a way to call n functions
 sequentially... is Function.defer meant for this?

 Thanks in advance.


If the functions are just normal ones, then.

function1();
function2();

If the functions are methods and they return the object to which they
are attached, then you can chain them.

function1().function2();



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] IE Issues

2010-09-21 Thread Richard Quadling
http://validator.w3.org/check?uri=http://www.meetscoresonline.com/results.aspx%3Ftax%3D1%26meetid%3D11590charset=(detect+automatically)doctype=Inlinegroup=0verbose=1

You have some errors here. Not all are important but some I'd be worried about.

 character data is not allowed here ✉
You have used character data somewhere it is not permitted to appear.
Mistakes that can cause this error include:

putting text directly in the body of the document without wrapping it
in a container element (such as a paragraph/p), or
forgetting to quote an attribute value (where characters such as %
and / are common, but cannot appear without surrounding quotes), or
using XHTML-style self-closing tags (such as meta ... /) in HTML
4.01 or earlier. To fix, remove the extra slash ('/') character. For
more information about the reasons for this, see Empty elements in
SGML, HTML, XML, and XHTML.
Line 88, column 9: character data is not allowed here
How to Contact MSO
 document type does not allow element X here; assuming missing Y start-tag ✉
Line 120, column 18: document type does not allow element OL here;
assuming missing LI start-tag
  ol
 end tag for X which is not finished ✉
Most likely, you nested tags and closed them in the wrong order. For
example pem.../p is not acceptable, as em must be closed
before p. Acceptable nesting is: pem.../em/p

Another possibility is that you used an element which requires a child
element that you did not include. Hence the parent element is not
finished, not complete. For instance, in HTML the head element must
contain a title child element, lists require appropriate list items
(ul and ol require li; dl requires dt and dd), and so on.

Line 71, column 36: end tag for UL which is not finished
ul class=result/ul
Line 202, column 85: end tag for UL which is not finished
…ul id=level_picker class=sub_menu level style=display:none/ul
Line 204, column 91: end tag for UL which is not finished
…  ul id=division_picker class=sub_menu division style=display:none/ul


And

 Character Encoding mismatch!

The character encoding specified in the HTTP header (utf-8) is
different from the value in the meta element (utf-16). I will use
the value from the HTTP header (utf-8) for this validation.



 Line 120, Column 18: document type does not allow element OL here;
assuming missing LI start-tag
  ol






-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Returning an array of results from an operation on an array.

2010-09-17 Thread Richard Quadling
Hi.

How do I do something like this (just an example) ...

[1,2,3].each(function(val){return val * val;});

such that the result is ...

[1,4,9]

It seems each() is returning the original value and not the calculation.

The full code is ...

$$('#cbGridContainer label').invoke('getLayout').invoke('get',
'left').uniq().each(function(val){return val = val -
i_ContainerLeft;}).join(',')

Alternatively, could the getLayout() method be extended to include
leftParentOffset and topParentOffset? Which is what I'm calculating.

Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Returning an array of results from an operation on an array.

2010-09-17 Thread Richard Quadling
On 17 September 2010 13:26, Jarkko Laine jar...@jlaine.net wrote:

 On 17.9.2010, at 15.03, Richard Quadling wrote:

 Hi.

 How do I do something like this (just an example) ...

 [1,2,3].each(function(val){return val * val;});

 such that the result is ...

 [1,4,9]

 [1,2,3].map(function(i){ return i * i }); // 
 http://api.prototypejs.org/language/enumerable/prototype/collect/

 Note that invoke is a shorthand for map except that it calls a method for 
 each of the items:

 ['hello', 'world'].invoke('toUpperCase'); // 
 http://api.prototypejs.org/language/enumerable/prototype/invoke/
 // - ['HELLO', 'WORLD']

 Cheers,
 //jarkko

.map()

ARGHH!! Wood 4 trees



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Chrome 5 refused to get unsafe header xjson

2010-09-16 Thread Richard Quadling
On 16 September 2010 11:21, nigeke...@googlemail.com
nigeke...@googlemail.com wrote:
 Content-Type: application/json;

That's the important bit.

So, now your JSON data will be in ...

transport.responseJSON

You don't need to evalJS() as JSON is JS.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Difference between $(el).writeAttribute('checked', true) and $(el).checked = true

2010-09-09 Thread Richard Quadling
Hi.

I'm having all sorts of fun with dynamically setting the check in a checkbox.

Which way should I do things?

Initially I thought something like this should work.

$$('#container label
input[type=checkbox][checked]').invoke('writeAttribute', 'checked',
false);

It doesn't.

Instead it seems I have to ...

$$('#container label
input[type=checkbox]').findAll(function(el){!!el.checked;}).each(function(el{el.checked
= false;});

Having worked out this setting the grid became a LOT easier ...

this.labels = $$(this.cssRuleName).invoke('removeClassName', 'cbGridChecked');
$$(this.cssRuleName + ' input[type=checkbox]')
.each(
function(el_Checkbox){
el_Checkbox.checked = (-1 !=
this.IDs.indexOf(parseInt(el_Checkbox.value, 10)));
},
this
);

Any ideas what is happening?
-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Keeping a draggable item within the viewport.

2010-09-07 Thread Richard Quadling
Hi.

I have a draggable div which I don't want to go outside of the current
view port.

I suspect that the onDrag callback will be of use, but I can't see how
to stop the drag from going out of bounds.

If someone can head me in the right direction then I'll get to it.

Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [Proto-Scripty] Re: Is there a way to determine if a parameter to a function is a Template?

2010-09-06 Thread Richard Quadling
Thank you TJ.

Another 'starred' email from you.

Thanks.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Just before I go home ...

2010-09-06 Thread Richard Quadling
Hi.

I'm about to go home and have a question for tomorrow's work.

1 - Take a div container.

2 - Use AJAX to add a bunch of labels/checkboxes. The labels are
supplied alphabetically sorted.

3 - Use JS to tidy the label widths so that the display looks like columns.

4 - Add an attribute to the labels indicating the column/row ordering
to be used.

5 - Sort the labels based upon the column/row ordering so that you
read the data in columns (e.g. a - g in col1, h - m in col2, etc.)

I've got this working, but I don't think it is particularly efficient.

So to my question.

Can I sort the children of a container so that after the sort, the
children are displayed in the new order?

Currently, I have to ...

1 - Add the labels to the container (inserting template.evaluate()'s
at bottom of container element).

2 - Read all the elements into an array.

3 - Sort the array.

4 - Zap the container.

5 - Re-add the elements.


I think I'd have to bubble sort the container's children by hand ...

Is that an appropriate solution?

Can I say something like (pseudo) ...

holdingElement = container.childElement[x];
container.childElement[x] = container.childElement[y];
container.childElement[y] = holdingElement;

sort of thing.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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: Just before I go home ...

2010-09-06 Thread Richard Quadling
On 6 September 2010 17:25, Richard Quadling rquadl...@gmail.com wrote:
 Hi.

 I'm about to go home and have a question for tomorrow's work.

 1 - Take a div container.

 2 - Use AJAX to add a bunch of labels/checkboxes. The labels are
 supplied alphabetically sorted.

 3 - Use JS to tidy the label widths so that the display looks like columns.

 4 - Add an attribute to the labels indicating the column/row ordering
 to be used.

 5 - Sort the labels based upon the column/row ordering so that you
 read the data in columns (e.g. a - g in col1, h - m in col2, etc.)

 I've got this working, but I don't think it is particularly efficient.

 So to my question.

 Can I sort the children of a container so that after the sort, the
 children are displayed in the new order?

 Currently, I have to ...

 1 - Add the labels to the container (inserting template.evaluate()'s
 at bottom of container element).

 2 - Read all the elements into an array.

 3 - Sort the array.

 4 - Zap the container.

 5 - Re-add the elements.


 I think I'd have to bubble sort the container's children by hand ...

 Is that an appropriate solution?

 Can I say something like (pseudo) ...

 holdingElement = container.childElement[x];
 container.childElement[x] = container.childElement[y];
 container.childElement[y] = holdingElement;

 sort of thing.




 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY


http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_22066768.html
informs me that I have to re-insert the item into the DOM for this to
trigger a redraw (I think that's what it is telling me).



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Is there a way to determine if a parameter to a function is a Template?

2010-09-01 Thread Richard Quadling
Hi.

I can't find a way to determine the type of object being supplied to a function.

I can check if it is a string ...

if (Object.isString(param)) {
 var tmpl = new Template(param);
} else if (Object.type(param) = 'Template') {
 var tmpl = param;
}

sort of thing.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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] Delaying the execution of an AJAX Request.

2010-08-31 Thread Richard Quadling
Hi.

Imagine a component which has a method which allows a third party to
supply some data after the initial creation of the component using
new.

e.g.

// Initial creation.
var myComp = new MagicComp({option1:value1, option2:value2});

// Some time later, maybe as a result of a click event.
myComp.setItems({item1:value1, item2:value2});

sort of thing.



Now, a common pattern would be to use an Ajax.Request to get the data.


I would like to have the ability to pass the ajax request as part of
the initial creation, but to not have the request actually actioned
until some time later.

Does the creation of an Ajax.Request force the execution of the
request in all circumstances.

I suppose all I'm really interested in is the URL of the request, but
I'd like to allow third parties more control over this if necessary.

// Initial creation.
var myCompAjaxed = new MagicCompAjaxed({option1:value1, ajax:new
AjaxRequestButNotYetActive()})


Ultimately, I'm trying to delay the request and processing within the
component until it is actually needed. And so I want to be able to
define all the information (params, callbacks, etc.) for the
Ajax.Request, but just not have it run until needed (just-in-time).

It would look like that my best option is something like ...

// Initial creation.
var myCompAjaxed = new MagicCompAjaxed({
 option1:value1,
 AjaxRequestURL : '';
 AjaxRequestOptions : {...}
});

and have ...

MagicCompAjaxed.doTheWork : function(){ new
Ajax.Request(this.AjaxRequestURL, this.AjaxRequestOptions)}

sort of thing.

But then how do I extract the data from the request (onSuccess()) but
still allow the end user to have an onSuccess option?

Argh.

Inheritence is the answer here ... just getting a little lost...

Or going down the wrong track entirely!




Any ideas/suggestions/examples/etc.

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.



Re: [Proto-Scripty] Delaying the execution of an AJAX Request.

2010-08-31 Thread Richard Quadling
On 31 August 2010 15:17, Johan Arensman johanm...@gmail.com wrote:
 Hello,

 Why not do exactly what you say, compose all the parameters for the request
 and execute whenever you want:

 var url = '/foo.php';
 var ajaxOptions = {
   option1: foo,
   option2: bar
 }

 // do whatever you want..

 // even add something
 ajaxOptions.option3 = 'bla';

 // then execute
 new Ajax.Request(url, ajaxOptions); // uses the ajaxOptions

 Or did I not fully understand what you wanted?

 Greetings,
  Johan


That was pretty much it. I couldn't find a way to put the Ajax.Request
on hold as such. Seems obvious now. Just build/run the request when
needed.

Thanks.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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




Re: [Proto-Scripty] Object extend magic

2010-08-31 Thread Richard Quadling
On 31 August 2010 17:49, kstubs kst...@gmail.com wrote:
 Hello,
 Full credit to: Matthew Foster for the code below.  I'd like an
 explanation of the below.  I'm having some troubles with Object extend
 and would like a better explanation of the magic that occurs below.


 $C = function(name, options) {
    return Element.extend(Object.extend(document.createElement(name ||
 div), options || {}));
 }


 Sample use:
 var next = $C(td, { innerHTML: gt;, className: next });

 So how are the properties innerHTML and className morphed on to this
 new td element?

 Thanks,
 Karl..

Object.extend takes a set of name/value pairs and applies them to
whatever object it is extending.

So, innerHTML and className, both properties of the DOM element TD,
get assigned by Object.extend.

Taking the code inside out ...

document.createElement(name || div) // Create an element based of
the type defined by the value of name or a div, if no name is
supplied.
Object.extend(..., options || {}) // Extend the object created about
with the name/value pairs in options, or not, if no options have been
supplied.
Element.extend(...) // Same as $(...);

Hope that helps.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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: Parameters whose intent is to identify elements.

2010-08-27 Thread Richard Quadling
On 27 August 2010 12:23, Richard Quadling rquadl...@gmail.com wrote:
 Hi.

 What is the best way to handle an option that could be ...

 1 - An elements ID : 'id'
 2 - An extended element : $('id')
 3 - A CSS rule : 'div#locked'
 4 - An array for a CSS rule : $$('div#floating')
 5 - An array of any of the above : ['id', $('id'), 'div#locked',
 $$('div#hidden')]

 The use case is to tell a class what it has to work with.

 var myGrid = new CBGrid('id', {before:, after:}); // for example

 where  and  are, in some way, the elements I want to interact with.

 Essentially, I want to be able to call invoke...

 this.options.before.invoke();
 this.options.after.invoke(...);

 sort of thing.


 --
 Richard Quadling.


Another option I may end up using is simply to provide a hook for
callbacks to allow the user to do what ever they want. This seems
easier.

Or am I missing a trick here?

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



Re: [Proto-Scripty] Javascript + regex

2010-08-24 Thread Richard Quadling
On 22 August 2010 14:52, johnwerry john.we...@gmail.com wrote:
 Trying to get the following gsub call working to replace text of url
 with link of the url.  I know I have to add slashes, but I am
 apparently missing some, somewhere as I can never get it to not error
 out.

 txt = txt.gsub(/\b(([\w-]+://?|www[.])[^\s()]+(?:\([\w\d]+\)|
 ([^[:punct:]\s]|/)))/,'a href=#{0}#{0}/a');

 Here is the add slashes version of the first parameter, but this
 errors out at runtime.  What am I missing?

 /\\b(([\\w-] ://?|www[.])[^\\s()] (?:\\([\\w\\d] \\)|([^[:punct:]\
 \s]|/)))/

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



Can you give some examples, so that we can check the regex.

Based upon what you've supplied ...



\b(([\w-]+://?|www[.])[^\s()]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))

Options: case insensitive; ^ and $ match at line breaks

Assert position at a word boundary «\b»
Match the regular expression below and capture its match into
backreference number 1
«(([\w-]+://?|www[.])[^\s()]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))»
   Match the regular expression below and capture its match into
backreference number 2 «([\w-]+://?|www[.])»
  Match either the regular expression below (attempting the next
alternative only if this one fails) «[\w-]+://?»
 Match a single character present in the list below «[\w-]+»
Between one and unlimited times, as many times as
possible, giving back as needed (greedy) «+»
A word character (letters, digits, and underscores) «\w»
The character “-” «-»
 Match the characters “:/” literally «:/»
 Match the character “/” literally «/?»
Between zero and one times, as many times as possible,
giving back as needed (greedy) «?»
  Or match regular expression number 2 below (the entire group
fails if this one fails to match) «www[.]»
 Match the characters “www” literally «www»
 Match the character “.” «[.]»
   Match a single character NOT present in the list below «[^\s()]+»
  Between one and unlimited times, as many times as possible,
giving back as needed (greedy) «+»
  A whitespace character (spaces, tabs, and line breaks) «\s»
  One of the characters “()” «()»
   Match the regular expression below «(?:\([\w\d]+\)|([^[:punct:]\s]|/))»
  Match either the regular expression below (attempting the next
alternative only if this one fails) «\([\w\d]+\)»
 Match the character “(” literally «\(»
 Match a single character present in the list below «[\w\d]+»
Between one and unlimited times, as many times as
possible, giving back as needed (greedy) «+»
A word character (letters, digits, and underscores) «\w»
A single digit 0..9 «\d»
 Match the character “)” literally «\)»
  Or match regular expression number 2 below (the entire group
fails if this one fails to match) «([^[:punct:]\s]|/)»
 Match the regular expression below and capture its match into
backreference number 3 «([^[:punct:]\s]|/)»
Match either the regular expression below (attempting the
next alternative only if this one fails) «[^[:punct:]\s]»
   Match a single character NOT present in the list below
«[^[:punct:]\s]»
  A character in the POSIX character class “punct” «[:punct:]»
  A whitespace character (spaces, tabs, and line breaks) «\s»
Or match regular expression number 2 below (the entire
group fails if this one fails to match) «/»
   Match the character “/” literally «/»


Created with RegexBuddy

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



Re: [Proto-Scripty] Javascript + regex

2010-08-24 Thread Richard Quadling
On 22 August 2010 14:52, johnwerry john.we...@gmail.com wrote:
 Trying to get the following gsub call working to replace text of url
 with link of the url.  I know I have to add slashes, but I am
 apparently missing some, somewhere as I can never get it to not error
 out.

 txt = txt.gsub(/\b(([\w-]+://?|www[.])[^\s()]+(?:\([\w\d]+\)|
 ([^[:punct:]\s]|/)))/,'a href=#{0}#{0}/a');

 Here is the add slashes version of the first parameter, but this
 errors out at runtime.  What am I missing?

 /\\b(([\\w-] ://?|www[.])[^\\s()] (?:\\([\\w\\d] \\)|([^[:punct:]\
 \s]|/)))/

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



http://pastebin.com/0E5MDkk2 is the same, but hopefully a little easier to read.

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



Re: [Proto-Scripty] Javascript + regex

2010-08-24 Thread Richard Quadling
On 24 August 2010 16:23, Richard Quadling rquadl...@gmail.com wrote:
 On 22 August 2010 14:52, johnwerry john.we...@gmail.com wrote:
 Trying to get the following gsub call working to replace text of url
 with link of the url.  I know I have to add slashes, but I am
 apparently missing some, somewhere as I can never get it to not error
 out.

 txt = txt.gsub(/\b(([\w-]+://?|www[.])[^\s()]+(?:\([\w\d]+\)|
 ([^[:punct:]\s]|/)))/,'a href=#{0}#{0}/a');

 Here is the add slashes version of the first parameter, but this
 errors out at runtime.  What am I missing?

 /\\b(([\\w-] ://?|www[.])[^\\s()] (?:\\([\\w\\d] \\)|([^[:punct:]\
 \s]|/)))/

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



 http://pastebin.com/0E5MDkk2 is the same, but hopefully a little easier to 
 read.

 --
 Richard Quadling.


Can you try ...

result = 
subject.replace(/\b(https?|ftp|file):\/\/[\-A-Z0-9+@#\/%?=~_|!:,.;]*[A-Z0-9+@#\/%=~_|]/img,
'a href=$$/a');

and pastebin http://pastebin.com/Ytc4KRT0

-- 
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] Would like to convert my little checkbox grid into a component of some sort.

2010-08-20 Thread Richard Quadling
Hi.

I have some code, developed using Prototye (code works in IE8, Firefox
and Chrome) which displays a list of checkboxes in an order that is
alphabetically sorted and displayed top to bottom, left to right in
auto-sized columns and padded to fit the width of the container.

So, if the list of items is a,b,c,d, if these were added to a
container and the container could display them 2 wide, the display
would be ...

a b
c d

My code will display them ...

a c
b d

See http://twitpic.com/2ggng3 for a real example. Notice how the names
are arranged in columns and easier to read. Find all the SFS ones is a
LOT easier this way.

It is probably pretty raw code - I'm not a genius.

What I'd like to do is componentize it, turn it into something that
is as simple to use as ...

new cbGrid('cbGridContainer', {options});

where options would include the data to show on the grid and anything
else that can be configured.

Currently I have only 1 use for it but maybe others could use it too.
The use I have is to display a list of contract names. The list is
dynamic and retrieved via an AJAX call.

I'm willing to do the donkey work, but would like some advice on how I
go about doing this.

I'm happy to make the code open source (where's the best place to show
it ... github? I've just created a public repository (but I've never
used git properly ... )

So. Anyone interested in some handholding whilst I get to grips with this?

Or have I just re-invented the wheel?

Regards,

Richard Quadling.

-- 
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] Dragging div's around the display.

2010-08-19 Thread Richard Quadling
Hi.

Is there a simple way to drag a div around the screen and simply
dropping it where it stands.

Top of my head ...

1 - on mouse down record ev.pointer() and ev.findElement('#draggable').
2 - on mouse move move the found element by same amount as mousedown
pointer x/y relative to the mousedown x/y
3 - on mouse up ... nothing

Seems simple enough.

What have I missed?

-- 
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: Dragging div's around the display.

2010-08-19 Thread Richard Quadling
On 19 August 2010 12:33, Richard Quadling rquadl...@gmail.com wrote:
 Hi.

 Is there a simple way to drag a div around the screen and simply
 dropping it where it stands.

 Top of my head ...

 1 - on mouse down record ev.pointer() and ev.findElement('#draggable').
 2 - on mouse move move the found element by same amount as mousedown
 pointer x/y relative to the mousedown x/y
 3 - on mouse up ... nothing

 Seems simple enough.

 What have I missed?

 --
 Richard Quadling.


What have I missed? Almost everything it seems...

include scriptaculous, effects, dragdrop

new Draggable('cbGrid');

Job done.


-- 
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] Appending a template evaluation to an HTML element.

2010-08-17 Thread Richard Quadling
Hi.

I've implemented a simple add new user button to my amend users
page. The user list is only about 20 people, with
name/email/pin/contracts/delete options.

The button calls a template evaluation and that is within an update ...

$('vsNewUsers').update($('vsNewUsers').innerHTML +
tmpl_NewUser.evaluate({NewUserID : --i_NewUserID}));

All working fine.

I like how it works, but I wonder how I can just append the result of
the evaluation.

How do I take a template and append the results to vsNewUsers.
vsNewUsers is a tbody element and the template is a tr element with
all the td's needed.

var tmpl_NewUser = new Template('trtdinput type=text
name=User[#{NewUserID}][Username] value= maxlength=200 size=50
//tdtdinput type=text name=User[#{NewUserID}][Email]
value= maxlength=200 size=50 //tdtdinput type=number
name=User[#{NewUserID}][PIN] value= maxlength=4
//tdtdinput class=vsaAllContracts type=checkbox
name=User[#{NewUserID}][AllContracts] value=1
id=allContracts_#{NewUserID} //tdtdinput type=text
name=User[#{NewUserID}][ContactIDs] value= maxlength=200
disabled=disabled size=50 /input type=hidden
name=User[#{NewUserID}][ContactIDs] value=/tdtdbutton
class=vsaChooseContracts bold
id=selectContracts_#{NewUserID}Select
contracts/button/tdtdinput type=checkbox
name=User[#{NewUserID}][Delete] value=#{NewUserID} //td/tr');

I'm thinking no.

Regards,

Richard.

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



Re: [Proto-Scripty] Appending a template evaluation to an HTML element.

2010-08-17 Thread Richard Quadling
On 17 August 2010 12:59, Phil Petree phil.pet...@gmail.com wrote:
 ===
 HTML save as index.html:
 html
 head
 script src=prototype.js/script
 /head
 body
 form id=myform
 table id=keytable
   trtdKeyword/tdtdinput type=text name=keyword_1/td/tr
 /table
 /form
 input type=button onclick=addkeyword() value=Add Keyword
 input type=button onclick=dosubmit() value=Submit
 div id=result style=padding:5px;
 /div
 script
 var nextkeyid = 2;
 function addkeyword()
 {
   var elTR = $('keytable').insertRow( -1 );
   var elTitleTD = elTR.insertCell( -1 );
   elTitleTD.appendChild( document.createTextNode( 'Keyword' ) );
   var elInput = document.createElement( 'input' );
   elInput.type = 'text';
   elInput.name = 'keyword_'+nextkeyid;
   nextkeyid++;
   var elInputTD = elTR.insertCell( -1 );
   elInputTD.appendChild( elInput );
 }
 function dosubmit( ) {
   new Ajax.Updater( 'result', 'add.php', { method: 'post', parameters:
 $('myform').serialize() } );
 }
 /script
 /body
 /html
 ===
 Serverside PHP save as add.php:

 Post Result:br/
 ?php var_export( $_POST ) ?
 ===
 On Tue, Aug 17, 2010 at 7:30 AM, Richard Quadling rquadl...@gmail.com
 wrote:

 On 17 August 2010 12:01, Phil Petree phil.pet...@gmail.com wrote:
  That's in the expando example that comes with prototype.js 1.6x
 
  On Tue, Aug 17, 2010 at 6:35 AM, Richard Quadling rquadl...@gmail.com
  wrote:
 
  Hi.
 
  I've implemented a simple add new user button to my amend users
  page. The user list is only about 20 people, with
  name/email/pin/contracts/delete options.
 
  The button calls a template evaluation and that is within an update ...
 
  $('vsNewUsers').update($('vsNewUsers').innerHTML +
  tmpl_NewUser.evaluate({NewUserID : --i_NewUserID}));
 
  All working fine.
 
  I like how it works, but I wonder how I can just append the result of
  the evaluation.
 
  How do I take a template and append the results to vsNewUsers.
  vsNewUsers is a tbody element and the template is a tr element with
  all the td's needed.
 
  var tmpl_NewUser = new Template('trtdinput type=text
  name=User[#{NewUserID}][Username] value= maxlength=200 size=50
  //tdtdinput type=text name=User[#{NewUserID}][Email]
  value= maxlength=200 size=50 //tdtdinput type=number
  name=User[#{NewUserID}][PIN] value= maxlength=4
  //tdtdinput class=vsaAllContracts type=checkbox
  name=User[#{NewUserID}][AllContracts] value=1
  id=allContracts_#{NewUserID} //tdtdinput type=text
  name=User[#{NewUserID}][ContactIDs] value= maxlength=200
  disabled=disabled size=50 /input type=hidden
  name=User[#{NewUserID}][ContactIDs] value=/tdtdbutton
  class=vsaChooseContracts bold
  id=selectContracts_#{NewUserID}Select
  contracts/button/tdtdinput type=checkbox
  name=User[#{NewUserID}][Delete] value=#{NewUserID} //td/tr');
 
  I'm thinking no.
 
  Regards,
 
  Richard.
 
  --
  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.
 
 
  --
  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.
 

 Can you point me to the URL please?

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


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


Now in comparison, that process (creating elements, assigning
properties, etc.) _LOOKS_ a lot more effort.

What do most developers do? Templates or createElement?

-- 
Richard Quadling.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype

Re: [Proto-Scripty] Re: Appending a template evaluation to an HTML element.

2010-08-17 Thread Richard Quadling
On 17 August 2010 16:34, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 The original code:

 $('vsNewUsers').update($('vsNewUsers').innerHTML +
 tmpl_NewUser.evaluate({NewUserID : --i_NewUserID}));

 ...will require the browser to spin through the tree inside vsNewUsers
 and create an equivalent HTML string to give you; then tear down that
 tree, parse the HTML you give it back (including re-parsing the stuff
 it just gave you), re-instantiate a lot of elements that look exactly
 the same as the previous one (plus the new ones at the end), re-
 calculate the layout of the previous elements (and then the additional
 ones), etc. (Layout can be expensive with tables, too, so...)

 Seems like unnecessary work. :-) Granted the browser's going to do it
 really fast, but still. Also, you'd lose any event handlers you'd
 hooked up to the elements in there and any other data you may have
 stored on them. If your user is using IE, any elements that
 Prototype's already extended will have to be re-extended (which takes
 non-trivial time on big tables).

 Fortunately, Element#insert[1] is for exactly this situation:

 $('vsNewUsers').insert({
    bottom: tmpl_NewUser.evaluate({NewUserID : --i_NewUserID})
 });

 [1] http://api.prototypejs.org/dom/element/insert/

 Vis-a-vis using `new Element` rather than HTML: Parsing HTML and
 showing the result on the page is fundamentally what browsers do, and
 they do it really, _really_ fast. When rendering HTML, they can work
 directly with their internal structures. When you use the DOM API, you
 lose that benefit and have to work through the browser's DOM API -
 internal structures mapping. And you're doing all of your work in an
 interpreted (or at least compiled-on-the-fly) language.

 Net result? Markedly slower -- like an order of magnitude -- to go
 through the DOM API vs. using HTML. This isn't a Prototype thing at
 all, it's just the nature of browsers and what they're optimized for.
 I actually did a test page (not much of one) a little over a year back
 when answering a question for someone that showed this in action, and
 through the wonder that is 'net search:
 http://pastie.org/521342

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

 On Aug 17, 2:09 pm, Phil Petree phil.pet...@gmail.com wrote:
 I would think that Creating elements is less limiting...  but I have no idea
 what most developers do.

 On Tue, Aug 17, 2010 at 8:29 AM, Richard Quadling rquadl...@gmail.comwrote:



   On 17 August 2010 12:59, Phil Petree phil.pet...@gmail.com wrote:
   ===
   HTML save as index.html:
   html
   head
   script src=prototype.js/script
   /head
   body
   form id=myform
   table id=keytable
     trtdKeyword/tdtdinput type=text name=keyword_1/td/tr
   /table
   /form
   input type=button onclick=addkeyword() value=Add Keyword
   input type=button onclick=dosubmit() value=Submit
   div id=result style=padding:5px;
   /div
   script
   var nextkeyid = 2;
   function addkeyword()
   {
     var elTR = $('keytable').insertRow( -1 );
     var elTitleTD = elTR.insertCell( -1 );
     elTitleTD.appendChild( document.createTextNode( 'Keyword' ) );
     var elInput = document.createElement( 'input' );
     elInput.type = 'text';
     elInput.name = 'keyword_'+nextkeyid;
     nextkeyid++;
     var elInputTD = elTR.insertCell( -1 );
     elInputTD.appendChild( elInput );
   }
   function dosubmit( ) {
     new Ajax.Updater( 'result', 'add.php', { method: 'post', parameters:
   $('myform').serialize() } );
   }
   /script
   /body
   /html
   ===
   Serverside PHP save as add.php:

   Post Result:br/
   ?php var_export( $_POST ) ?
   ===
   On Tue, Aug 17, 2010 at 7:30 AM, Richard Quadling rquadl...@gmail.com
   wrote:

   On 17 August 2010 12:01, Phil Petree phil.pet...@gmail.com wrote:
That's in the expando example that comes with prototype.js 1.6x

On Tue, Aug 17, 2010 at 6:35 AM, Richard Quadling 
  rquadl...@gmail.com
wrote:

Hi.

I've implemented a simple add new user button to my amend users
page. The user list is only about 20 people, with
name/email/pin/contracts/delete options.

The button calls a template evaluation and that is within an update
  ...

$('vsNewUsers').update($('vsNewUsers').innerHTML +
tmpl_NewUser.evaluate({NewUserID : --i_NewUserID}));

All working fine.

I like how it works, but I wonder how I can just append the result of
the evaluation.

How do I take a template and append the results to vsNewUsers.
vsNewUsers is a tbody element and the template is a tr element with
all the td's needed.

var tmpl_NewUser = new Template('trtdinput type=text
name=User[#{NewUserID}][Username] value= maxlength=200
  size=50
//tdtdinput type=text name=User[#{NewUserID

Re: [Proto-Scripty] Re: Touch screen / mouse gesturing.

2010-08-05 Thread Richard Quadling
On 4 August 2010 18:08, Eric lefauv...@gmail.com wrote:
 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.

You _would_ be surprised then ...

But, an excellent idea. 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.



Re: [Proto-Scripty] Re: $$()

2010-08-05 Thread Richard Quadling
On 4 August 2010 18:20, Eric lefauv...@gmail.com wrote:

 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


Hmm. In my use of this construct, I've always been careful when using
findElement(). The selector in use will be an accurate one and will
always return the element I want. I'd suspect that the documentation
is fine. Could/should I be more careful ... probably, but this has
worked for me for a LONG time and the UX testers haven't spotted
anything untorward with regards to this issue.

As with all things you get off the internet ... YMMV.

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



Re: [Proto-Scripty] Form.serialize and unchecked checkboxes

2010-08-01 Thread Richard Quadling
On 30 July 2010 18:56, strimp099 strimp...@gmail.com wrote:
 Greetings all:

 When sending form variables as a hash using Form.serialize(true), the
 value attribute of unchecked checkboxes is sent to the POST page. This
 of course is contrary to how HTML treats checkbox form variables.

 for example, I have the following checkboxes:

 input type=checkbox name=destructor value=true id=destructor
 checked=checked /
 input type=checkbox name=constructor value=true
 id=constructor checked=checked /

 I only want destructor and constructor to be passed as true if the
 checkbox is checked. Form.serialize(true) sends the true value even
 when it is not checked.

 Does anyone know how to ensure that if a checkbox is not checked, the
 value attribute will not be sent when using Form.serialize()?

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



You've set the checked attribute on both of the checkboxes. So both
are checked and both will be sent.

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



Re: [Proto-Scripty] $$()

2010-07-30 Thread Richard Quadling
On 30 July 2010 10:51, Yozefff yoze...@gmail.com wrote:
 Question ..

 Let's say I have 100 input fields, type = text. I want to put a onblur
 on all of them and pointing to the same function.

 So I've used

 $$(input) and invoke a blur.

 This works .. but my question is .. will this generate 100 events? So
 will my memory get filled with 100 on blurr events?

 Would it be the same if I just Even.subscribe 100 times?

 greets

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



I'd recommend putting the onblur on the form element and use
Event.findElement('input[type=text]')

e.g.

$('form_id').observe('blur', function(ev) {
 var el = ev.findElement('input[type=text]');
 if (el) {
  // el is the element that triggered the blur.
 }
});

sort of thing.

Regards,

Richard.

[1] http://api.prototypejs.org/dom/event/findelement/

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

2010-07-29 Thread Richard Quadling
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.



Re: [Proto-Scripty] Re: Effect.multiple and toggle

2010-07-21 Thread Richard Quadling
On 20 July 2010 23:37, Febo ilpuccio.f...@gmail.com wrote:
 Thanks Richard and Ralph,

 I'm studing the code but my feeling is that Effect.toggle can't handle
 the Object which is always passed by Effect.multiple as last parameter
 or let's say effect.

 I don't know very much JavaScript, so I came up with this solution.
 I added a funciton to public/javascripts/prototype.js

  Toggle: function(element, options) {
    element = $(element);
    effect = ($(options)['effect'] || 'appear').toLowerCase();
    Effect.toggle(element, effect, options);
  }

 calling the multiple function:

 Effect.multiple(['id_1','id_2',...,'id_n'], Effect.Toggle,
 {'effect':'appear'})

 I tested the curry but without success, perhaps I'm not so good in JS
 so I didn't catch the concept of curry.
 If you have a better solution, let me know.

 The problem with the class solution is that I have a table and I want
 to hide some rows of this table, I set the class of each row to odd/
 even for zebra colouring.

 On 20 Lug, 19:08, Richard Quadling rquadl...@gmail.com wrote:
 On 20 July 2010 17:59, Ralph Brickley i...@topsoftweb.com wrote:



  This is a revelation to me. I didn't know Effect had a multiple. Also, 
  what is curry?

  My solution has been to tag those elements with a class, ie div 
  class=effects

  Then use $$('effects') to get each item and all effects... On each

  Sent from my iPhone

  On Jul 20, 2010, at 9:08 AM, Richard Quadling rquadl...@gmail.com wrote:

  On 20 July 2010 15:55, Febo ilpuccio.f...@gmail.com wrote:
  Hello,
  I'd like to use the toggle effect on multiple object at the same time
  I tried with

  Effect.multiple(['id_1','id_2','id_n'], Effect.toggle)

  but it doesn't work, also I don't know where/how to pass the 'appear'
  parameter

  I'm used to call toggle in this way:
  Effect.toggle('my_id_of_interest','appear')

  At a guess, you need to curry() [1] the parameter.

  So, can you try ...

  Effect.multiple(['id_1','id_2','id_n'], Effect.toggle.curry('appear'));

  Regards,

  Richard.

  [1]http://api.prototypejs.org/language/function/prototype/curry/

 Curries (burns in) arguments to a function, returning a new function
 that when called with call the original passing in the curried
 arguments (along with any new ones)

 The linkhttp://api.prototypejs.org/language/function/prototype/curry/
 is the documentation for curry.

 So, Effect.toggle.curry('appear') returns a new function which, when
 called, will call the Effect.toggle function with  'appear' as the
 first parameter, along with any other parameters supplied by the
 Effect.multiple() function.

 Is it the same as $$('effects').invoke('toggle', 'appear');

 Hmm. On the surface, probably yes. But I'm not an expert here.

 One difference is that Effect.multiple allows you to supply any ids.

 I suppose ...

 Effect.multiple($$('effects'), Effect.toggle.curry('appear'));

 could also be a similar approach.

Ah. Yes. toggle requires the element first. Using curry() puts the
parameters the wrong way round.

Sorry about that.

So...

Effect.multiple
 (
 ['id1', 'id2'],
 function(el) { Effect.toggle(el, 'appear');}
 );

maybe.

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



Re: [Proto-Scripty] Re: Effect.multiple and toggle

2010-07-21 Thread Richard Quadling
On 21 July 2010 13:10, Richard Quadling rquadl...@gmail.com wrote:
 On 20 July 2010 23:37, Febo ilpuccio.f...@gmail.com wrote:
 Thanks Richard and Ralph,

 I'm studing the code but my feeling is that Effect.toggle can't handle
 the Object which is always passed by Effect.multiple as last parameter
 or let's say effect.

 I don't know very much JavaScript, so I came up with this solution.
 I added a funciton to public/javascripts/prototype.js

  Toggle: function(element, options) {
    element = $(element);
    effect = ($(options)['effect'] || 'appear').toLowerCase();
    Effect.toggle(element, effect, options);
  }

 calling the multiple function:

 Effect.multiple(['id_1','id_2',...,'id_n'], Effect.Toggle,
 {'effect':'appear'})

 I tested the curry but without success, perhaps I'm not so good in JS
 so I didn't catch the concept of curry.
 If you have a better solution, let me know.

 The problem with the class solution is that I have a table and I want
 to hide some rows of this table, I set the class of each row to odd/
 even for zebra colouring.

 On 20 Lug, 19:08, Richard Quadling rquadl...@gmail.com wrote:
 On 20 July 2010 17:59, Ralph Brickley i...@topsoftweb.com wrote:



  This is a revelation to me. I didn't know Effect had a multiple. Also, 
  what is curry?

  My solution has been to tag those elements with a class, ie div 
  class=effects

  Then use $$('effects') to get each item and all effects... On each

  Sent from my iPhone

  On Jul 20, 2010, at 9:08 AM, Richard Quadling rquadl...@gmail.com wrote:

  On 20 July 2010 15:55, Febo ilpuccio.f...@gmail.com wrote:
  Hello,
  I'd like to use the toggle effect on multiple object at the same time
  I tried with

  Effect.multiple(['id_1','id_2','id_n'], Effect.toggle)

  but it doesn't work, also I don't know where/how to pass the 'appear'
  parameter

  I'm used to call toggle in this way:
  Effect.toggle('my_id_of_interest','appear')

  At a guess, you need to curry() [1] the parameter.

  So, can you try ...

  Effect.multiple(['id_1','id_2','id_n'], Effect.toggle.curry('appear'));

  Regards,

  Richard.

  [1]http://api.prototypejs.org/language/function/prototype/curry/

 Curries (burns in) arguments to a function, returning a new function
 that when called with call the original passing in the curried
 arguments (along with any new ones)

 The linkhttp://api.prototypejs.org/language/function/prototype/curry/
 is the documentation for curry.

 So, Effect.toggle.curry('appear') returns a new function which, when
 called, will call the Effect.toggle function with  'appear' as the
 first parameter, along with any other parameters supplied by the
 Effect.multiple() function.

 Is it the same as $$('effects').invoke('toggle', 'appear');

 Hmm. On the surface, probably yes. But I'm not an expert here.

 One difference is that Effect.multiple allows you to supply any ids.

 I suppose ...

 Effect.multiple($$('effects'), Effect.toggle.curry('appear'));

 could also be a similar approach.

 Ah. Yes. toggle requires the element first. Using curry() puts the
 parameters the wrong way round.

 Sorry about that.

 So...

 Effect.multiple
  (
  ['id1', 'id2'],
  function(el) { Effect.toggle(el, 'appear');}
  );

 maybe.


On http://script.aculo.us/, opening the console command line (using
Google Chrome).

Entered

Effect.multiple(['header','ninja'],function(el){Effect.toggle(el, 'appear');})

and the 2 elements fade out.

Repeat the all and they fade back in.

So this looks like a winner.

In essence the curry() call was doing ...


Effect.multiple(['header','ninja'],function(el){Effect.toggle('appear',el);})

which is why it wasn't working for you. Sorry again.

Regards,

Richard.

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



Re: [Proto-Scripty] not send data in URL?

2010-07-20 Thread Richard Quadling
On 20 July 2010 06:24, geoffcox g...@freeuk.com wrote:
 Hello

 I have this php code

 for ($count=0;$countsizeof($units);$count++) {
 echo a href='btec-first/index.php?unit= . $units[$count] .
 folder=/ .  $btec_first_folder[$units[$count]-1] . '
 target='content'BTEC First - Unit  . $units[$count] . /abr\n;
 }

 which sends the data to file index.php as part of the URL.

 Is it possible to use POST instead so that the path info is not
 visible to the user?

 I have thought of ajax/prototype but this would need the array data to
 be passed to JavaScript and not clear how to do this?

 Any other way?

 Cheers

 Geoff

You could have to create a form with am input type=hidden for each
unit and folder and a bit of JS to turn an a into a form submitter -
or just use a button.

If you want to use ajax, then the same mechanism - create the form,
but use an ajax submitter to process the forms.

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



Re: [Proto-Scripty] Effect.multiple and toggle

2010-07-20 Thread Richard Quadling
On 20 July 2010 15:55, Febo ilpuccio.f...@gmail.com wrote:
 Hello,
 I'd like to use the toggle effect on multiple object at the same time
 I tried with

 Effect.multiple(['id_1','id_2','id_n'], Effect.toggle)

 but it doesn't work, also I don't know where/how to pass the 'appear'
 parameter

 I'm used to call toggle in this way:
 Effect.toggle('my_id_of_interest','appear')

At a guess, you need to curry() [1] the parameter.

So, can you try ...

Effect.multiple(['id_1','id_2','id_n'], Effect.toggle.curry('appear'));


Regards,

Richard.

[1] http://api.prototypejs.org/language/function/prototype/curry/

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



Re: [Proto-Scripty] Effect.multiple and toggle

2010-07-20 Thread Richard Quadling
On 20 July 2010 17:59, Ralph Brickley i...@topsoftweb.com wrote:
 This is a revelation to me. I didn't know Effect had a multiple. Also, what 
 is curry?

 My solution has been to tag those elements with a class, ie div 
 class=effects

 Then use $$('effects') to get each item and all effects... On each

 Sent from my iPhone

 On Jul 20, 2010, at 9:08 AM, Richard Quadling rquadl...@gmail.com wrote:

 On 20 July 2010 15:55, Febo ilpuccio.f...@gmail.com wrote:
 Hello,
 I'd like to use the toggle effect on multiple object at the same time
 I tried with

 Effect.multiple(['id_1','id_2','id_n'], Effect.toggle)

 but it doesn't work, also I don't know where/how to pass the 'appear'
 parameter

 I'm used to call toggle in this way:
 Effect.toggle('my_id_of_interest','appear')

 At a guess, you need to curry() [1] the parameter.

 So, can you try ...

 Effect.multiple(['id_1','id_2','id_n'], Effect.toggle.curry('appear'));


 Regards,

 Richard.

 [1] http://api.prototypejs.org/language/function/prototype/curry/

Curries (burns in) arguments to a function, returning a new function
that when called with call the original passing in the curried
arguments (along with any new ones)

The link http://api.prototypejs.org/language/function/prototype/curry/
is the documentation for curry.

So, Effect.toggle.curry('appear') returns a new function which, when
called, will call the Effect.toggle function with  'appear' as the
first parameter, along with any other parameters supplied by the
Effect.multiple() function.

Is it the same as $$('effects').invoke('toggle', 'appear');

Hmm. On the surface, probably yes. But I'm not an expert here.

One difference is that Effect.multiple allows you to supply any ids.

I suppose ...

Effect.multiple($$('effects'), Effect.toggle.curry('appear'));

could also be a similar approach.

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



Re: [Proto-Scripty] Re: not send data in URL?

2010-07-20 Thread Richard Quadling
On 20 July 2010 20:58, geoffcox g...@freeuk.com wrote:

 You could have to create a form with am input type=hidden for each
 unit and folder and a bit of JS to turn an a into a form submitter -
 or just use a button.

 If you want to use ajax, then the same mechanism - create the form,
 but use an ajax submitter to process the forms.

 Thanks for your reply.

 Isn't it possible to pass the unit and folder data to JavaScript and
 then use something like

 var params = ({
 unit: unit_given,
 folder: folder_given
 });

 new Ajax.Request('send.php',
  {
    method:'post', parameters: params,

 etc?

 Cheers

 Geoff

That sort of thing. But I'd use a form and add an observer on the
submit. This would allow for graceful degradation.

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



Re: [Proto-Scripty] Re: Element.select works wrong when select tag a

2010-07-17 Thread Richard Quadling
On 16 July 2010 15:42, Quyết Tiến doquyett...@gmail.com wrote:
 yes

 On Jul 16, 8:42 pm, Richard Quadling rquadl...@gmail.com wrote:
 On 16 July 2010 07:37, Quyết Tiến doquyett...@gmail.com wrote:

  a href=# rel=dhtmlwindowcontent/a

 Is that a typo?

 a href=# rel=dhtmlwindowcontent/a

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



So, you've got some HTML. With errors. And you are expecting it to
work correctly.

Or have I missed something.

If a browser has to make corrections to your HTML to render it, or
just guesses as to what you mean, you can't expect the browser to read
you mind and know what you want. So when you then attempt to add
styles, observers, etc. you are pretty much standing on a house of
cards.

Clean the HTML.

What happens now.

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



Re: [Proto-Scripty] Element.select works wrong when select tag a

2010-07-16 Thread Richard Quadling
On 16 July 2010 07:37, Quyết Tiến doquyett...@gmail.com wrote:
 a href=# rel=dhtmlwindowcontent/a

Is that a typo?

a href=# rel=dhtmlwindowcontent/a

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



Re: [Proto-Scripty] Issue after hiding divs on load

2010-07-15 Thread Richard Quadling
On 11 July 2010 05:01, Acryte acry...@gmail.com wrote:
 Hi, I'm working on a site where I have it load the page, and then I
 have a content box containing a textfield and customized scrollbar
 (custom images,width, etc) for the field. I have multiple content
 boxes and I used script.aculo.us to basically make them appear or fade
 when the menu pics are clicked etc. This was great but then I wanted
 to make them all hidden when the page loads, and then have them shown
 if you click the link. Like for news, you click it and the content box
 for news shows up. The problem I am having is that when I set the
 display for the div with id ContentBox to display=none since prototype
 uses display for show/hide/appear/fade I thought that would work fine.
 but it doesnt. I'm sure its a simple fix that I'm just not seeing.

 What happens is, if I say for example:

 window.onload = function() {
  $$('div.tabcontent').invoke('hide');
 };

 or

 document.observe(dom:loaded, function() {
  $$('div.tabcontent').invoke('hide');
 });

 then it will hide it to begin with, but later on, even if it's right
 after that, if I tell it to show, and use something like toggle, show,
 appear... etc. what happens is, it shows the content box, but the text
 field and scrollbar inside it are both hidden.

 if I use the div specifically like:
 $('contentBox').hide()

 it will still hide but once again it won't show when I tell it to show
 or appear.

 I know there must be a simple solution because when I say:
 window.onload = function() {
  $$('div.tabcontent').invoke('fade');
 };
 it works when later on I tell it to show or appear just hide makes
 it not work.

 Also, I made a temporary solution by using iframes since I was already
 using them for the gallery with my shadowbox. I used it for the
 content box. I put them in an iframe positioned using a div in a
 table. Works good except for 1 thing, when I use my scriptaculous
 custom scrollbar, if my mouse goes outside of the frame/table (one of
 the 2 not sure exactly but) then it no longer is observing when I
 mouseup... so that when I bring the mouse back into the frame, it will
 then act as if I was still mousedown and scroll the scrollbar as I
 move the mouse up and down which is terrible. I don't mind using the
 frames, it would make editing easy because each content window could
 be a separate little html file, but at the same time I can't seem to
 figure out how to fix this either. My attempts at both have failed so
 now I'm asking for some help, thanks :)

 --
 You received this message because you are subscribed to the Google Groups 
 Prototype  script.aculo.us group.
 To post to this group, send email to prototype-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.



You have to apply the inline style=display:none;

Element.show cannot display elements hidden via CSS stylesheets. Note
that this is not a Prototype limitation but a consequence of how the
CSS display property works. [1]

Regards,

Richard.

[1] http://api.prototypejs.org/dom/element/show/

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



Re: [Proto-Scripty] Re: .innerHTML Undefined form name error

2010-07-14 Thread Richard Quadling
On 14 July 2010 13:46, ColinFine colin.f...@pace.com wrote:


 On Jul 13, 11:44 am, Richard Quadling rquadl...@gmail.com wrote:
 On 13 July 2010 10:59, Lemmi l...@vipixel.de wrote:

  On Jul 13, 11:28 am, Richard Quadling rquadl...@gmail.com wrote:
  ?

 http://groups.google.com/group/prototype-scriptaculous/post

 I meant what had been hijacked? What subject had been changed?

 I wonder if someone got mixed up between Hariz's and Hari's posts?

 When I opened the link in the digest mail (http://groups.google.com/
 group/prototype-scriptaculous/t/e7477360befc6ca1, with text
 .innerHTML Undefined form name error google groups opened this
 thread, which is headed Conflict when Prototype is included twice
 and started by Jojo.
 Before Hariz' posting on July 12 is the line

        Discussion subject changed to .innerHTML Undefined form name
 error by Hariz Soleminio

 When Google groups tells me the subject has been changed, I think the
 subject has probably been changed. :-)

Ha! I get the emails as they are. This thread is just an unconnected
message. Sorry for the confusion.

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



Re: [Proto-Scripty] .innerHTML Undefined form name error

2010-07-13 Thread Richard Quadling
On 12 July 2010 18:02, Hariz Soleminio harriz_solemi...@rocketmail.com wrote:
 Hi,

 I would like to ask about using innerHTML in forms.
 I use it to change form every time the user change the form by select box.

 When I post it in other page using Firefox i keep having error :
 Notice: Undefined index: nameofform in C:\page.php on line 3

 but it works well in IE.

 what seems to be the problem guys,

 Thanks..

How are you accessing the form? $('nameofform') ?

If so, do you have form name=nameofform id=nameofform ...

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



Re: [Proto-Scripty] Re: .innerHTML Undefined form name error

2010-07-13 Thread Richard Quadling
On 13 July 2010 10:10, ColinFine colin.f...@pace.com wrote:
 Please DO NOT change the name of an existing discussion. If you have a
 new topic, start a new discussion.


?


 On Jul 12, 6:02 pm, Hariz Soleminio harriz_solemi...@rocketmail.com
 wrote:
 Hi,

 I would like to ask about using innerHTML in forms.
 I use it to change form every time the user change the form by select box.

 When I post it in other page using Firefox i keep having error :
 Notice:  Undefined index: nameofform in C:\page.php on line 3

 but it works well in IE.

 what seems to be the problem guys,


 We cannot possibly tell what is the problem unless you give us at
 least a little bit of your code.

 But that looks like a PHP Notice to me, not a browser one. Where is it
 appearing?


How on earth did I miss that Being a ZCE and all ... Just shoot me now.

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



Re: [Proto-Scripty] Re: .innerHTML Undefined form name error

2010-07-13 Thread Richard Quadling
On 13 July 2010 10:59, Lemmi l...@vipixel.de wrote:
 On Jul 13, 11:28 am, Richard Quadling rquadl...@gmail.com wrote:
 ?

 http://groups.google.com/group/prototype-scriptaculous/post

I meant what had been hijacked? What subject had been changed?

I wonder if someone got mixed up between Hariz's and Hari's posts?

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



Re: [Proto-Scripty] Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 11:22, Alex McAuley webmas...@thecarmarketplace.com wrote:
 But richard... Font sizes and styles aside... the span with the largest
 amount of text will still be the widest and vice versa!!...

 ABCDEFG is still wider than ABCDE no matter the font size!!

 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message - From: Richard Quadling rquadl...@gmail.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Thursday, July 01, 2010 11:57 PM
 Subject: Re: [Proto-Scripty] Sorting some spans.


 On 1 July 2010 21:28, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

 If I was tackling this I would attach a class and id to the spans and
 select
 them all then find out all of the widths of each span as a number then
 sort
 them into high to low / low to high then redraw them all .. Prolly not
 the
 most efficient but it would work.

 If you are using php you could do this without javascript based on strlen
 of
 the text that sits in the span and sort() / usort() the array then loop
 it
 ...

 The widths are dependent upon the font, size and styling being used,
 not under my control.

 The size of the display isn't under my control.

 So all of this is done in realtime on the client. Chrome is WAY the
 fastest in this and is not really noticeable.

 IE and FF are quite slow, but I've not yet optimized the code.

 So once the client has tidied the display, I know how many columns I
 can have to fill.

 The example I provided is dummy data and without the JS to do the calc.

 I'm stuck on the algorithm for sorting the data the way I want. I can
 see that I need to tag the spans if I want to sort them, but I can't
 work out what the sort mechanics need to be.


W is a LOT wider than an i


And if they style this in a narrow font, I may get 8 columns. If they
style with additional images (flags, logos, etc.), then the width is
very much different.

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



Re: [Proto-Scripty] Re: Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 09:34, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi Richard,

 I've got a div containing a set of spancheckboxlabel/span
 sort of thing.

 OT, and not to throw a spanner in, but I assume if you're doing that,
 you have an ID on every checkbox and a `for` on every label (so the
 labels know what checkbox they relate to). You can avoid that and
 ditch the span as well:

    labelcheckboxLabel text/label

 That will automatically associate the label with the checkbox, no IDs
 or `for`s required.

 Re the sorting:

 So once the client has tidied the display, I know how many columns I
 can have to fill.

 Do you know this before you create the grid? Or do you have to create
 the grid before you know how many columns you have, and *then* sort
 it?

 -- T.J. :-)

I don't create a real grid/table. I'm just using left floats with
fixed width spans (and I'll be changing that to the embedded cbs in
labels - 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.



Re: [Proto-Scripty] Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 22:37, Richard Quadling rquadl...@gmail.com wrote:
 On 2 July 2010 11:22, Alex McAuley webmas...@thecarmarketplace.com wrote:
 But richard... Font sizes and styles aside... the span with the largest
 amount of text will still be the widest and vice versa!!...

 ABCDEFG is still wider than ABCDE no matter the font size!!

 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message - From: Richard Quadling rquadl...@gmail.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Thursday, July 01, 2010 11:57 PM
 Subject: Re: [Proto-Scripty] Sorting some spans.


 On 1 July 2010 21:28, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

 If I was tackling this I would attach a class and id to the spans and
 select
 them all then find out all of the widths of each span as a number then
 sort
 them into high to low / low to high then redraw them all .. Prolly not
 the
 most efficient but it would work.

 If you are using php you could do this without javascript based on strlen
 of
 the text that sits in the span and sort() / usort() the array then loop
 it
 ...

 The widths are dependent upon the font, size and styling being used,
 not under my control.

 The size of the display isn't under my control.

 So all of this is done in realtime on the client. Chrome is WAY the
 fastest in this and is not really noticeable.

 IE and FF are quite slow, but I've not yet optimized the code.

 So once the client has tidied the display, I know how many columns I
 can have to fill.

 The example I provided is dummy data and without the JS to do the calc.

 I'm stuck on the algorithm for sorting the data the way I want. I can
 see that I need to tag the spans if I want to sort them, but I can't
 work out what the sort mechanics need to be.


 W is a LOT wider than an i


 And if they style this in a narrow font, I may get 8 columns. If they
 style with additional images (flags, logos, etc.), then the width is
 very much different.


A real example from one of the data sets.

Hill Hire
ASDA

OK, Hill Hire _is_ wider than ASDA, but only just, yet has more than
twice the number of characters.

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



Re: [Proto-Scripty] morph effects on menu roll-over.. better way?

2010-07-01 Thread Richard Quadling
On 1 July 2010 03:53, Matt matthew.jones...@gmail.com wrote:
 Hey, i am pretty new to prototype and script.aculo.us and have decided
 to develop a menu that utilizes the morph feature. It works in this
 manner; when a menu item is mouseover it causes 2 morphs to occur, and
 reverses the morph when the menu item is mouseleave. (two vertical
 divider bars are the elements to be morphed, located on either side of
 a menu item)

 I have got it working as i want it to so far but am having problems
 with flickering, and disappearing elements on either side of a menu
 item as every menu item shares one common divider element with the
 menu item beside it..

 maybe i am going about coding this all wrong, but i think it should be
 possible to use morph in this way.. any suggestions as to how to clean
 it up and get rid of flickering/disappearing vertical elements so it
 runs smoothly?
 I have seen some examples of using timers, and checks for events
 running, but im not sure if they would apply in this situation.

 here is the test page:
 http://al-linplumbing.com/js_menutest.html

 the code can be viewed by viewing the page source as to not clutter up
 the post.

 if i need to explain the effect i am trying to achieve more, please
 let me know.

 Thanks,
 Matt


Try combining the effects to run in parallel.

http://wiki.github.com/madrobby/scriptaculous/effect-parallel

-- 
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] Sorting some spans.

2010-07-01 Thread Richard Quadling
Hi.

I've got a div containing a set of spancheckboxlabel/span
sort of thing.

Using some CSS and JS I've got all the checkboxes to line up in a grid
and it all looks very nice.

The labels are from a DB and are ordered alphabetically.

But when rendered, the list reads across and then down, rather than
down and then across.

e.g.

a b c d
e f g h
i j k l

rather than

a d g j
b e h k
c f i l

The grid (via the JS) auto sizes the spans to equally space the
elements. The number of columns is determined by the maximum size of
the labels, the size of the container and the screen size. None of
which is under my control, and therefore I'll never know up front how
many columns.

So, with that, is there a way to reorder the spans so they read in
columns first.

I've got a static mockup at http://pastebin.com/Sb5A83wh

Any ideas?

Regards,

Richard.

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



Re: [Proto-Scripty] Sorting some spans.

2010-07-01 Thread Richard Quadling
On 1 July 2010 21:28, Alex McAuley webmas...@thecarmarketplace.com wrote:
 If I was tackling this I would attach a class and id to the spans and select
 them all then find out all of the widths of each span as a number then sort
 them into high to low / low to high then redraw them all .. Prolly not the
 most efficient but it would work.

 If you are using php you could do this without javascript based on strlen of
 the text that sits in the span and sort() / usort() the array then loop it
 ...

The widths are dependent upon the font, size and styling being used,
not under my control.

The size of the display isn't under my control.

So all of this is done in realtime on the client. Chrome is WAY the
fastest in this and is not really noticeable.

IE and FF are quite slow, but I've not yet optimized the code.

So once the client has tidied the display, I know how many columns I
can have to fill.

The example I provided is dummy data and without the JS to do the calc.

I'm stuck on the algorithm for sorting the data the way I want. I can
see that I need to tag the spans if I want to sort them, but I can't
work out what the sort mechanics need to be.

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



Re: [Proto-Scripty] Need an enhanced select type control.

2010-06-29 Thread Richard Quadling
On 29 June 2010 15:37, Alex McAuley webmas...@thecarmarketplace.com wrote:
 I tackled a similar problem with checkboxes and a fixed height size div
 containing them...

 My list is 200+ checkboxes with labels and only 5 or so are displayed until
 you scroll

 perhaps somehting like this ?


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message - From: Richard Quadling rquadl...@gmail.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, June 29, 2010 3:00 PM
 Subject: [Proto-Scripty] Need an enhanced select type control.


 Hi.

 I'm looking for an alternative to a select multiple box which allows
 for checkboxes against a table of items.

 Ideally, I'd like it to look like a select tag that is seen on IE and
 FireFox (a droplist), that, when you click to expand the list, you get
 the bigger page of items with checkboxes and an accept/reject or
 ok/cancel button to close the box.

 The list of items is currently at 80 and grows by 1 or 2 every month.

 So the list needs to flow in a nice size grid. Some items are a LOT
 longer than others. I don't always know the display size and some
 users will be using a mobile device (iPhone).

 The lack of a hold for more type key on a touch device leads me to
 need a checkbox setup.

 Plus, this allows me to show all the options on the screen at once in
 a much easier fashion.

 There will be multiple instances of the grid on the page, each with
 different checkboxes selected.

 A nice touch would be to have the collapsed element show ...

 Item A, Item B, ...

 sort of thing.

 Anyway, anyone know of such a beast before I spend any time on this?

 Regards,

 Richard.

 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling

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



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



Sounds good. Essentially anything that doesn't require a keypress to
select multiple entries.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [Proto-Scripty] Re: Setting the focus on an input after an effect to show the input.

2010-06-15 Thread Richard Quadling
On 12 June 2010 10:37, bill will...@techservsys.com wrote:
 On 6/11/2010 5:07 PM, Walter Lee Davis wrote:

 Yes, but is there only one form on the entire page at any time? That's the
 point I was trying to get at here. If you have two inputs with the same ID,
 you can call focus() but only the first one with that ID will gain focus.

 Walter

 It is a violation of the spec to have 2 elements with the same ID.  IDs are
 supposed to be unique in a page.

 bill

 On Jun 11, 2010, at 4:57 PM, Richard Quadling wrote:

 The afterFinish is what I needed. Thanks.

 The form in question has 2 inputs and it is the first one that I want
 to get the focus on.

 Thank you.

 I didn't see anything in the scripy docs, but I've probably missed it.



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


The ids are unique. Thanks.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [Proto-Scripty] Re: Setting the focus on an input after an effect to show the input.

2010-06-11 Thread Richard Quadling
On 11 June 2010 16:07, Walter Lee Davis wa...@wdstudio.com wrote:
 One question though -- is there only ever one $('requestVehicle') in the
 page? If you use the ID method to call an object like this, you are making
 that contract with the browser -- only one thing will ever match that
 selector.

 If there are many such, then don't give them IDs, or be sure to give them
 unique IDs, and then use a 'relative' lookup like maybe

 $('vsContainer').down('input.someClass').focus();

 As long as it's inside an anonymous function, that selector won't fire until
 the outer function is called, so it will be correctly populated (since
 you're in afterFinish and you know the div has been made visible).

 Walter

 On Jun 10, 2010, at 5:07 PM, Gregory Nicholas wrote:

 it should be as follows:

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

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


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



The afterFinish is what I needed. Thanks.

The form in question has 2 inputs and it is the first one that I want
to get the focus on.

Thank you.

I didn't see anything in the scripy docs, but I've probably missed it.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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

2010-06-10 Thread Richard Quadling
Hi.

I have a page where divs are displayed using a nice simple parallel
Fade/Appear effect. I also fade in the divs on the initial page
load.

In some of the divs, there are input tags. I want to be able to
set focus to the tag.

Trying to do so generates an error.

My fade in code is

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

In vsContainer, there is an element input type=text maxlength=10
name=vsRequest[Vehicle] id=requestVehicle value= /

I want to put the focus on this element.

Normally,

$('requestVehicle').focus();

would do the trick, and if I type that into the console (chrome,
firefox, IE8), then it works just fine.

But not when placed immediately after the effect, I get an error -
essentially $('requestVehicle') is null.

I've tried using ...

myFocus(el){el.focus();}

myFocus.defer('requestVehicle');

But nope.

What would be nice is if there was a way to chain the focus call to
the end of the Effect.Parallel code. If Effect.Parallel fired an event
when the job was finished (for example).

Any ideas?


-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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

2010-06-10 Thread Richard Quadling
Hi.

I have a page where divs are displayed using a nice simple parallel
Fade/Appear effect. I also fade in the divs on the initial page
load.

In some of the divs, there are input tags. I want to be able to
set focus to the tag.

Trying to do so generates an error.

My fade in code is

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

In vsContainer, there is an element input type=text maxlength=10
name=vsRequest[Vehicle] id=requestVehicle value= /

I want to put the focus on this element.

Normally,

$('requestVehicle').focus();

would do the trick, and if I type that into the console (chrome, firefox, IE


-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
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] Adding an effect to AJAX'd data.

2010-06-08 Thread Richard Quadling
Hi.

I've got a simple little page I'm building for our fleet inspectors.
Trying to make it look nicer.

The issue I'm coming up against is the single threaded nature of
JavaScript (I think that's the issue I coming up against).

The onSuccess() callback reads Response.responseJSON.Order.Details and
uses a template to add the details to the page.

The template is ...

var tmpl_Wheel = new Template('div class=vsWheel
style=display:none
id=Wheel_#{Wheel}h2#{Position}/h2div#{Description}/divdiv#{Serial}/divdiv#{Date}/divdiv#{Supplier}/divdiv#{Depot}/div/div');

As you can see, the style is display:none, so that I can add a
progressive reveal to the wheels.

The trouble is, I can't call the new Effect.Appear('Wheel_' + Wheel)
because it doesn't exist yet.

So.

I've got the add the wheels to the display code as ...

var s_Wheels = '';
o_Response.responseJSON.Order.each(function(o_Wheel){
s_Wheels = s_Wheels + tmpl_Wheel.evaluate(o_Wheel);
});
$('vsWheels').update(s_Wheels);

And then I want to add the effect.

o_Response.responseJSON.Order.each(function(o_Wheel){
new Effect.Appear(
'Wheel_' + o_Wheel.Wheel,{
delay: 0.25 * parseInt(o_Wheel.Wheel, 10),
duration : 0.50,
from : 0.00,
to   : 1.00
}
);
});


Initially, the effect was in the same loop (with each wheel being
updated as it went).

But this isn't working either.

What options do I have for this?

Essentially, the data comes in via AJAX and I want it to appear one
wheel at a time, with each wheel being slightly delayed so that they
appear smoothly.

Regards,

Richard Quadling.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
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] Firing a click event.

2010-04-08 Thread Richard Quadling
Hi.

Brain has gone to sleep.

I've got a form where I'd like to be able to allow some controls to be
disabled by a checkbox.

Working code ...

script type=text/javascript
function handleHideClick(ev)
{
hideClick(ev.element());
}

function hideClick(el)
{
el.up('tr').select('input[type=text]')
.each
(
function(el2)
{
el2.disabled = el.checked;
}
);
}

document.observe('dom:loaded', function(ev_dom_loaded)
{
$$('.dtl_Blank input[type=checkbox]').each(function (el)
{
hideClick($(el).observe('click', handleHideClick));
});
});
/script

Is there a way to simplify this?

I initially thought that Element.fire() would help, but that is for
custom events only.

Essentially, whilst setting the click handler, I want to be able to
call the handler also.

Regards,

Richard.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
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: Firing a click event.

2010-04-08 Thread Richard Quadling
On 8 April 2010 12:20, Richard Quadling rquadl...@googlemail.com wrote:
 Hi.

 Brain has gone to sleep.

 I've got a form where I'd like to be able to allow some controls to be
 disabled by a checkbox.

 Working code ...

 script type=text/javascript
 function handleHideClick(ev)
        {
        hideClick(ev.element());
        }

 function hideClick(el)
        {
        el.up('tr').select('input[type=text]')
                .each
                        (
                        function(el2)
                                {
                                el2.disabled = el.checked;
                                }
                        );
        }

 document.observe('dom:loaded', function(ev_dom_loaded)
        {
        $$('.dtl_Blank input[type=checkbox]').each(function (el)
                {
                hideClick($(el).observe('click', handleHideClick));
                });
        });
 /script

 Is there a way to simplify this?

 I initially thought that Element.fire() would help, but that is for
 custom events only.

 Essentially, whilst setting the click handler, I want to be able to
 call the handler also.

 Regards,

 Richard.
 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


Ha!

Seems that [1] and [2] have it covered.


OOI, the fireEvent code at the bottom of [1] (Post #9 by Rick),
(cleaned up the quotes) ...

function fireEvent(element,event){
  if(document.createEvent){
// dispatch for firefox + others
var evt = document.createEvent('HTMLEvents');
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
  } else {
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on' + event,evt)
  }
}

looks good and useful.

Is there a way to get this tested across a wide range of
browsers/os/etc.? Does Prototype have a test farm?

Richard.

[1] http://jehiah.cz/archive/firing-javascript-events-properly
[2] http://lifescaler.com/2008/04/simulating-mouse-clicks-in-javascript/



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
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] $$() for a specific root.

2010-03-29 Thread Richard Quadling
Hi,

I can use ...

$$('#tbl_Charges .dtl_Tyre, #tbl_Charges .dtl_Repair, #tbl_Charges
.dtl_Service, #tbl_Charges .dtl_Blank').each(function(el){...});

I now want to do a further $$ on el in for each...

el.$$('.rCharge, .rValue, .rDesc').each(function(el2){...});

but I don't know how to use $$ in this way.

I think I need to use Selector, but I don't know the proper CSS rules
in this instance.

Regards,

Richard.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [Proto-Scripty] how to check is the function = Prototype.emptyFunction ?

2010-02-01 Thread Richard Quadling
On 1 February 2010 13:02, buda www...@pochta.ru wrote:
 var Obj = {};
 Obj.meth = Prototype.emptyFunction;

 if (Obj.meth !== Prototype.emptyFunction) {
  alert('Not equal');
 }

 why alert show everytime?

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



Why?

The main advantage of the emptyFunction is that you can always call it
without having to do a null/undefined test first.

If you want to know if it has been assigned something, then don't
assign the emptyFunction, leave it as null and then test if it is
null.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [Proto-Scripty] Re: how to check is the function = Prototype.emptyFunction ?

2010-02-01 Thread Richard Quadling
On 1 February 2010 15:44, buda www...@pochta.ru wrote:
 it was simple sheme and it wasnt the stright code
 it must be like this

 var Obj = {};
  ...
 Obj.meth = Prototype.emptyFunction;
  ...
 if (Obj.meth !== Prototype.emptyFunction) {
  alert('Not equal');
 }

 does this irritates you?

 On Feb 1, 5:37 pm, Alex Wallace alexmlwall...@gmail.com wrote:
 This is getting into dirty territory (or at least I'd feel so) but:

  var x = function(){};
  var y = function(){ alert(foo); }
  x + ;
 function () { }
  y + ;

 function () { alert(foo); }

 Best,
 Alex



 On Mon, Feb 1, 2010 at 10:29 AM, buda www...@pochta.ru wrote:
  the question is: how to check if a function is empty or have any code

  On Feb 1, 5:18 pm, Richard Quadling rquadl...@googlemail.com wrote:
   On 1 February 2010 13:02, buda www...@pochta.ru wrote:

var Obj = {};
Obj.meth = Prototype.emptyFunction;

if (Obj.meth !== Prototype.emptyFunction) {
 alert('Not equal');
}

why alert show everytime?

--
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 athttp://
  groups.google.com/group/prototype-scriptaculous?hl=en.

   Why?

   The main advantage of the emptyFunction is that you can always call it
   without having to do a null/undefined test first.

   If you want to know if it has been assigned something, then don't
   assign the emptyFunction, leave it as null and then test if it is
   null.

   --
   -
   Richard Quadling
   Standing on the shoulders of some very clever giants!
   EE :http://www.experts-exchange.com/M_248814.html
   EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp
   Zend Certified Engineer :
 http://zend.com/zce.php?c=ZEND002498r=213474731
   ZOPA :http://uk.zopa.com/member/RQuadling-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.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.



Can you try ...

alert((Obj.meth + '') == (Prototype.emptyFunction + ''));

I'm getting True for when Obj.meth is the emptyFunction.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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

2009-10-29 Thread Richard Quadling

2009/10/29 Russell Keith russell.ke...@aacreditunion.org:
 Ok, maybe I’m just being dense, but I am reading the API for forms and I am
 getting nothing from it.



 What is proper use of the $F utility and what can it do for me?  I have read
 the Form.Element.getValue and it means nothing to me.



 I have this form:



     form name=createPDF action=/pdf/pdf_process.php method=POST

     input type=hidden name=A_NAME value=John /

     input type=hidden name=APPLY_DATE value=?=date(m/d/Y)? /

     input type=hidden name=A_BIRTH_DATE value=01/01/01 /

     input type=hidden name=L_NAME value=Jane /

     input type=hidden name=L_BIRTH_DATE value=01/01/01 /

     input type=hidden name=A_ACCOUNT value=1 /

     /form



 When I try to do alert($F(‘A_NAME’)); I get an ‘Object does not support this
 property or method’ error.  I get the same error when I try to submit the
 form with ‘document.createPDF.submit();’ is there something wrong with my
 form?

 


$F() returns the element. So,

alert($F('A_ACCOIUNT').value);

should be what you are looking for,

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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

2009-10-29 Thread Richard Quadling

2009/10/29 Richard Quadling rquadl...@googlemail.com:
 2009/10/29 Russell Keith russell.ke...@aacreditunion.org:
 Ok, maybe I’m just being dense, but I am reading the API for forms and I am
 getting nothing from it.



 What is proper use of the $F utility and what can it do for me?  I have read
 the Form.Element.getValue and it means nothing to me.



 I have this form:



     form name=createPDF action=/pdf/pdf_process.php method=POST

     input type=hidden name=A_NAME value=John /

     input type=hidden name=APPLY_DATE value=?=date(m/d/Y)? /

     input type=hidden name=A_BIRTH_DATE value=01/01/01 /

     input type=hidden name=L_NAME value=Jane /

     input type=hidden name=L_BIRTH_DATE value=01/01/01 /

     input type=hidden name=A_ACCOUNT value=1 /

     /form



 When I try to do alert($F(‘A_NAME’)); I get an ‘Object does not support this
 property or method’ error.  I get the same error when I try to submit the
 form with ‘document.createPDF.submit();’ is there something wrong with my
 form?

 


 $F() returns the element. So,

 alert($F('A_ACCOIUNT').value);

 should be what you are looking for,

 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling



OOps.

Completely wrong.

The form elements do not have IDs, so you need to add them for $F() to work.

http://api.prototypejs.org/dom/form/element.html#getvalue-class_method

See that the parameter is an element.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--~--~-~--~~~---~--~~
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: object.each problem

2009-10-02 Thread Richard Quadling

2009/10/2 Dave dave.ease...@googlemail.com:

 Thanks Richard

 I have checked the API for new/changed features between 1.5.0 and
 1.6.0, but I'm getting null returned in the second parameter.
 


What headers are you supplying with the JSON'd data from the server?

For JSONP, I use Content-type: application/javascript
For JSON, I use Content-type: X-JSON

These work great for me.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--~--~-~--~~~---~--~~
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: object.each problem

2009-10-02 Thread Richard Quadling

2009/10/2 Dave dave.ease...@googlemail.com:

 On Oct 2, 10:46 am, Richard Quadling rquadl...@googlemail.com wrote:

 What headers are you supplying with the JSON'd data from the server?

 For JSONP, I use Content-type: application/javascript
 For JSON, I use Content-type: X-JSON

 These work great for me.

 Thanks for the reply.

 The server code wasn't setting headers explicitly so I've now added
 this, setting it to application/json, and I get a return value in the
 second parameter. This now saves me needing to do the eval on the
 responseText, but my original problem still exists in that having
 upgraded to prototype 1.6.0, the original code no longer works unless
 I convert the reply to hash using $H(). I don't know if this is now
 the correct way of handling this, or whether I should be doing
 something else, or whether it is a bug. As far as I can tell, the
 purpose of the code was to extend the evaluated response text to add
 iterator methods. When I compare the old and new version responses I
 can see no difference, but something has changed between the prototype
 versions as the object.extend now causes the code to fail when I try
 to iterate using object.each.
 


I have a JSON object ...

{Result:1,UniqueID:5,Username:Chrome,Email:,LastLogin:Monday,
14supth\/sup September 2009 at 10:28
AM,ContractID:0,Password:,Rights:{Disabled:false,UserAdmin:false,ReportAdmin:false,RunReports:true}

To iterate the Rights, I use ...

$H(o_JSONUser.Rights).each
(
function(h_Right)
{
$('tabUA_Rights' + h_Right.key).checked = (1 == 
h_Right.value);
}
);

So, I would say you have to turn the object to a Hash for each()
to work on it.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--~--~-~--~~~---~--~~
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: prevent space bar jump on keypress observe

2009-10-02 Thread Richard Quadling

2009/10/2 Stucture_Ulf maximilian.moulet...@gmail.com:

 hello and thanks for your answer!

 here's an extract from the script I'm using

 Event.observe(document, 'keypress', function(event) {
  if(event.keyCode==8 ){
     //content here
  }
  if(event.keyCode==0 ){
     //content here
  }
 });

 I tried to change from Event.observe(document to window but this has
 no effect. I can catch the event .keycode from the space bar, it is
 0...But I do not now how to prevent the browser from scrolling down
 the page when space bar is pressed.

 On Oct 1, 12:32 am, Miguel Beltran R. yourpa...@gmail.com wrote:
 2009/9/30 Stucture_Ulf maximilian.moulet...@gmail.com



  I'm using an event observe to catch keystrokes and to add entered
  characters to a certain div. but i have a problem with the space bar
  button that causing a jump scroll on the page. looks like this is a
  browser function, is it possible to catch and prevent? would be
  grateful for any tips on how to stop this.

  maybe add the observe to window or document, but how say if the div

 have the focus?
 


if(event.keyCode==0 ){
 event.stop();
}

should do the trick.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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