Re: [Proto-Scripty] Re: decisions decisions -- json - ajax - html and dom kungfu

2011-11-11 Thread Richard Quadling
Also, the use of templates may be a better option, especially if you
are populating pre-defined fragments.

Just supply the data to the template evaluator and insert it into the DOM.

On 9 November 2011 19:34, Victor  wrote:
> So you plan to receive JSON from server, then convert it to HTML and insert
> into page? HTML fragments are much easier in writing/validating/processing.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/prototype-scriptaculous/-/DAxhHxaBOFkJ.
> 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 28 October 2011 16:37, Richard Quadling  wrote:
> On 20 October 2011 13:30, Luke  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

The rules exist and I have a width of 50px set already.

It is something that works for me.


-- 
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  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-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  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 
> wrote:
>>
>> On 11 October 2011 00:04, nelian  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] Silly Question

2011-10-11 Thread Richard Quadling
On 11 October 2011 00:04, nelian  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 13:09, Phil Petree  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-30 Thread Richard Quadling
On 30 September 2011 12:53, Chris Sansom  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 10:27, Chris Sansom  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-29 Thread Richard Quadling
On 29 September 2011 16:58, Chris Sansom  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  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] Image cache problem with Ajax

2011-09-29 Thread Richard Quadling
On 29 September 2011 15:00, Chris Sansom  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] Acceptable nicks(s) For Prototype.js

2011-09-12 Thread Richard Quadling
On 11 September 2011 12:06, kstubs  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  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  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  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 
>> 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] New to creating slideshows

2011-06-21 Thread Richard Quadling
On 20 June 2011 19:27, Monaleasaa  wrote:
> I have created a website using Google Sites Gallery (the free website)
> and I want to create a slide show for it.  I used Picasa but I didn't
> like the information notation that shows up on each slideshow.
>
> I would like to use Scriptaculous and I have down loaded the latest
> version but right off the start I am stuck.
>
> Can anyone tell me where I would find the directory to create the
> "java script" file?
>
> If it is on Google's server how do I get access to my websites
> location?
>
> Thanks, Monaleasaa
>
> --
> You received 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.
>
>

https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"</a>;>
https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js"</a>;>

See http://code.google.com/apis/libraries/devguide.html#prototype


-- 
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  wrote:
>
>
> On Jun 7, 8:05 am, 操坤  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  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] Re: future of script.aculo.us

2011-03-28 Thread Richard Quadling
On 28 March 2011 11:48, T.J. Crowder  wrote:
>> What the future will be Prototype and script.aculo.us
>> if my future developers want to choose only one library.
>> Which should we choose for future ? and why ?
>
> Predicting the future is a mug's game. Right now, jQuery is huge. It
> has corporate sponsors, full-time staff, a massive userbase, and a lot
> of momentum. Prototype doesn't have corporate sponsors or full-time
> staff, I _think_ the userbase is rather smaller (but I don't have
> numbers for that and there are a LOT of people using it with Rails),
> and releases and new features aren't coming as quickly by comparison.
> Both have passionate individuals extending, contributing to, and using
> them.
>
> But all that could change in, seemingly, seconds. The community could
> take against a direction jQuery goes. A new library could appear that
> takes over the world, pushing both Prototype and jQuery to the
> sidelines. A megasponsor could decide that Prototype is the bee's
> knees and hire people to work on it full-time.
>
> If you review the replies in this thread, there's a clear theme: Teach
> fundamentals, not libraries. JavaScript is a rich and very powerful
> language that probably doesn't quite work the way your students think
> it does. Make sure they understand it. Make sure they understand the
> DOM -- not necessarily the details of the DOM API beyond a few basics,
> but the fundamentals of elements and trees and nodes and documents.
> Teach them how browsers work, and the nature and consequences (and
> advantages) of asynchronous communication between client and server.
> Teach them about JSON and basic XML. Teach them to seek, and read,
> details from primary sources like the ECMAScript specification, the
> various DOM specs, the CSS spec, the HTML5 spec, etc., rather than
> relying on meta-sources like w3schools (*shudder*).
>
> Do that, they'll have no trouble picking up any library they want to
> with just a couple of hours' work reading the API docs, kicking around
> the related tags on StackOverflow or the discussion group for the lib,
> and tinkering.
>
> Best,
> --
> T.J. Crowder
> Independent Software Engineer
> tj / crowder software / com
> www / crowder software / com
>
> On Mar 24, 11:09 am, "Ali.MD"  wrote:
>> thank you very much
>> my question about future
>> jQuery and prototype and some other javascript library is similar to
>> each other
>> I can not find a significant difference between them. is that right ?
>> a agree jquery is better to teach. and we must to teach other
>> javascript library with jQuery
>> I'm worried about the future
>> What the future will be Prototype and script.aculo.us
>> if my future developers want to choose only one library.
>> Which should we choose for future ? and why ?
>> i dont worry about plugins and extensions because we can use all of
>> them together  ;)

T.J., where do I sign up? I like your style. When I was first exposed
to a GUI environment, the first thing I was taught, beyond everything
else regarding app and the tools, was how to use the help system.

Without doubt, a first principles approach will allow new developers
to bypass a lot of the dead-end techniques that come from not having
the bigger picture in mind.

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

2011-03-18 Thread Richard Quadling
On 18 March 2011 11:43, Luke  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  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.  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  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  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.



[Proto-Scripty] Suggestions for a small private project.

2011-02-03 Thread Richard Quadling
Hi.

I've got an archive of a PHP framework. The archive contains the 55
official releases and patch levels to date. It is NOT an SVN/CVS
repository, just a directory for each release and expanded content in
each directory.

There are just over 111,000 files in total.

What I'm looking for is a quick way to see the differences between the
different versions for a particular file.

To that end, the idea I've got is to have a two panel display.

The left panel is a tree view of combined contents of all the versions
(but missing the version from the tree).

library
 framework
 class1.php
 class2.php
 class3.php


So, if a file is added in version x, it will appear in the appropriate
place in the tree.

The second panel will somehow display the versions and the differences
between the versions.


My backend is PHP. I'm happy in producing and caching the diffs (the
diff between version A and version B will never change, so once
generated, a cache will be fine.


The idea is to be able to see the evolution of a class through its
releases and to be able to see the changes.


I'm pretty sure I'm reinventing the wheel here to some degree.


For the tree, I was thinking of using something like ExtJS, but I
don't know enough about the licensing issues going on in there.

I like Prototype, but there doesn't seem to be the UI components for
Prototype/Scripty that other libraries have.

Ideally, I'd like to be able to use the frontend on multiple source
trees. That can easily be handled server side with a small list on
screen to choose the project and tree style.

So. What suggestions do you have.

Regards,

Richard.


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

-- 
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  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  wrote:
> I've done the following a lot in a piece of code I'm working on:
>
> var t = new Template('...');
> $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] 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  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  wrote:
>> On 22 December 2010 18:16, Walter Lee Davis  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] Is there a way to DRY this up?

2010-12-23 Thread Richard Quadling
On 22 December 2010 18:16, Walter Lee Davis  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: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 10:14, Luke  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] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 08:32, Luke  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  wrote:
>> On 16 December 2010 16:36, Luke  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 08:32, Luke  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  wrote:
>> On 16 December 2010 16:36, Luke  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] Can I change what new [someClass] will return?

2010-12-16 Thread Richard Quadling
On 16 December 2010 16:36, Luke  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  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  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] Re: finding absolute position of an element

2010-12-07 Thread Richard Quadling
On 7 December 2010 16:17, doug  wrote:
>
>
> On Dec 7, 10:58 am, Richard Quadling  wrote:
>> On 7 December 2010 15:34, doug  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: [Proto-Scripty] finding absolute position of an element

2010-12-07 Thread Richard Quadling
On 7 December 2010 15:34, doug  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: 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  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  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  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
>> > wrote:
>> > > On Wed, Nov 17, 2010 at 09:01, petrob  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  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  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.



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



[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  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] AJAX callbacks are not executed atomically?

2010-09-25 Thread Richard Quadling
On 24 September 2010 20:21, JoJo  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.



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

2010-09-22 Thread Richard Quadling
On 22 September 2010 12:50, Kupido  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.



[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] IE Issues

2010-09-21 Thread Richard Quadling
http://validator.w3.org/check?uri=http://www.meetscoresonline.com/results.aspx%3Ftax%3D1%26meetid%3D11590&charset=(detect+automatically)&doctype=Inline&group=0&verbose=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 aragraph), 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 ) 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
  
 end tag for X which is not finished ✉
Most likely, you nested tags and closed them in the wrong order. For
example ... is not acceptable, as  must be closed
before . Acceptable nesting is: ...

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  element must
contain a  child element, lists require appropriate list items
( and  require ;  requires  and ), and so on.

Line 71, column 36: end tag for "UL" which is not finished

Line 202, column 85: end tag for "UL" which is not finished
…
Line 204, column 91: end tag for "UL" which is not finished
…  


And

 Character Encoding mismatch!

The character encoding specified in the HTTP header (utf-8) is
different from the value in the  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
  






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



[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] Re: Chrome 5 refused to get unsafe header xjson

2010-09-16 Thread Richard Quadling
On 16 September 2010 11:21, 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.



Re: [Proto-Scripty] Re: Updating Google's AJAX API repository to Prototype 1.7RC2

2010-09-16 Thread Richard Quadling
On 16 September 2010 11:33, T.J. Crowder  wrote:
> Hi,
>
> I don't think the core team generally push betas to Google (and that's
> what an RC is, a beta -- a late-stage beta to be sure, but a beta).
> Only GAs go there as far as I know.
>
> No idea how far 1.7 is from being released. The Lighthouse project[1]
> is showing 28% complete, with 47 of 170 tickets resolved, but I expect
> some (many?) of those remaining tickets will be moved to a 1.7.1
> milestone or some such.
>
> [1] https://prototype.lighthouseapp.com/projects/8886/home
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / com
> www / crowder software / com
>
> On Sep 16, 11:21 am, Richard Quadling  wrote:
>> Hi.
>>
>> I'm trying to demonstrate a problem I'm having. Embedding my own
>> Prototype seems daft. I'd like to be able to use the Google's AJAX API
>> repository, but they don't have 1.7RC2 there.
>>
>> Who is responsible for getting these up to date?
>> Will an RC get to the repository?
>>
>> On a side note, does anyone have any idea how far 1.7 is away from
>> being ready for release?
>>
>> As always, my sincere thanks to all of you for your generosity in
>> providing such a world class library.
>>
>> (Hmmm, laying it on a bit thick, maybe?! But meant!)
>>
>> Regards,
>>
>> Richard.

Thank you.

-- 
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] Updating Google's AJAX API repository to Prototype 1.7RC2

2010-09-16 Thread Richard Quadling
Hi.

I'm trying to demonstrate a problem I'm having. Embedding my own
Prototype seems daft. I'd like to be able to use the Google's AJAX API
repository, but they don't have 1.7RC2 there.

Who is responsible for getting these up to date?
Will an RC get to the repository?

On a side note, does anyone have any idea how far 1.7 is away from
being ready for release?

As always, my sincere thanks to all of you for your generosity in
providing such a world class library.

(Hmmm, laying it on a bit thick, maybe?! But meant!)

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: Chrome 5 refused to get unsafe header xjson

2010-09-15 Thread Richard Quadling
On 15 September 2010 16:17, nigeke...@googlemail.com
 wrote:
> Thanks for response Richard. Not sure exactly what you mean.
>
> The response from the server when I key in the url directly to chrome
> is a json array/hash of previously entered data:
>
> [{"post":
> {"device":"palm","location":"dublin","created_at":"2010-09-09T06:03:58Z","updated_at":"2010-09-09T06:03:58Z","nickname":"nige","level":
> 82,"id":1,"devid":"001000230","score":200,"message":"my score sucks"}},
> {"post":
> {"device":"iphone","location":"london","created_at":"2010-09-09T17:13:20Z","updated_at":"2010-09-09T17:13:20Z","nickname":"greg","level":
> 54,"id":2,"devid":"465465468","score":6000,"message":"Check it out.
> Love this game!!"}}}
>
> Matches what I entered. So that's ok.
>
> The server is a Rails server. Webrick outputs the following when I use
> the code from my first post:
>
> Processing ApplicationController#index (for y.y.y.221 at 2010-09-15
> 14:59:22) [OPTIONS]
>
> But by directly keying in the url to chrome Rails responds with:
>
> Processing PostsController#index to js (for y.y.y.221 at 2010-09-15
> 15:01:16) [GET]
>
> It's like the request is not understood by Rails.Or it is malformed
> somehow. It doesn't get it's a GET request and bypasses the
> PostsController.
>
>
>
>
> On Sep 15, 2:21 pm, Richard Quadling  wrote:
>> On 15 September 2010 12:28, nigeke...@googlemail.com
>>
>>
>>
>>
>>
>>  wrote:
>> > I have the following request in my app. It works fine in Safari 5.
>>
>> > new Ajax.Request('http://x.x.x.x:3000/posts.js',
>> >        {
>> >            method:'get',
>> >            requestHeaders: {Accept: 'application/json'},
>> >            onSuccess: function(transport){
>> >                    var response = transport.responseText;
>> >                    var posts = response.evalJSON();
>> >                     etc
>> >             }
>> >      });
>>
>> > In chrome 5 I get the error Refused to get unsafe header "X-JSON".
>>
>> > When I point the chrome browser at my url json is returned but with
>> > the warning:
>> > Resource interpreted as document but transferred with MIME type text/
>> > javascript.
>>
>> > The content type in the request is application/x-www-form-urlencoded.
>>
>> > Any ideas?
>>
>> > Nige
>>
>> What type is the response forhttp://x.x.x.x:3000/posts.js


But what are the HTTP headers?

In PHP ...

// Send X-JSON / application/json headers and content if 
possible.
if (!headers_sent())
{
if (False !== $a_JSON['Header'])
{
$a_JSON['Header']['Queries'] = $a_Query;
$a_JSON['Header']['Session'] = $_SESSION;
header('X-JSON: ' . 
json_encode($a_JSON['Header']));
}
if (False !== $a_JSON['Detail'])
{
header('Content-type: application/json');
sort($a_JSON['Detail']);
echo json_encode($a_JSON['Detail']);
}
}

>From that, in JavaScript, I can use ...

response.headerJSON and response.responseJSON

Without the headers, things don't work properly as the browser assumes
it is text or html coming down the line.

-- 
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] Chrome 5 refused to get unsafe header xjson

2010-09-15 Thread Richard Quadling
On 15 September 2010 12:28, nigeke...@googlemail.com
 wrote:
> I have the following request in my app. It works fine in Safari 5.
>
> new Ajax.Request('http://x.x.x.x:3000/posts.js',
>        {
>            method:'get',
>            requestHeaders: {Accept: 'application/json'},
>            onSuccess: function(transport){
>                    var response = transport.responseText;
>                    var posts = response.evalJSON();
>                     etc
>             }
>      });
>
> In chrome 5 I get the error Refused to get unsafe header "X-JSON".
>
> When I point the chrome browser at my url json is returned but with
> the warning:
> Resource interpreted as document but transferred with MIME type text/
> javascript.
>
> The content type in the request is application/x-www-form-urlencoded.
>
> Any ideas?
>
> Nige
>
> --
> You received 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.
>
>

What type is the response for http://x.x.x.x:3000/posts.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.



[Proto-Scripty] Re: Just before I go home ...

2010-09-06 Thread Richard Quadling
On 6 September 2010 17:25, Richard Quadling  wrote:
> Hi.
>
> I'm about to go home and have a question for tomorrow's work.
>
> 1 - Take a  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] 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  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.



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.



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

2010-09-05 Thread Richard Quadling
On 4 September 2010 07:54, Johan Arensman  wrote:
> Feature checking is usually done by checking for a specific method or
> attribute on the object.
> For a template you can check for the evaluate method:
> if(MyObject.evaluate) {
>   // it's a template
> }
>
> On Wed, Sep 1, 2010 at 5:20 PM, Richard Quadling 
> wrote:
>>
>> 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.

I found instanceof also to work for 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.



Re: [Proto-Scripty] Re: Object extend magic

2010-09-02 Thread Richard Quadling
All good points Rob!
-- 
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.



Re: [Proto-Scripty] Re: Object extend magic

2010-09-01 Thread Richard Quadling
On 31 August 2010 20:16, kstubs  wrote:
> I notice that if I intend to add class to an element that I must use
> className and not class for my object.  But what if I intend to name
> my element?  What do you use then?  For example:
>
> { className : "foo", innerHTML : "bar" }
>
> On a newly defined TD yields:
> bar
>
> But if the object is:
> { name="somename", className : "foo", innerHTML : " }
> The attribute name *does not appear* on my new TD element.
> Originally, I was doing this:
>
> { class : "foo", innerHTML : "bar" }
>
> And was never getting class on my TD object.  So how do you know which
> names to use in order to get the result on the element you desire?
>
> Thanks,
> Karl..
>
> On Aug 31, 11:20 am, kstubs  wrote:
>> Thanks Richard for your answer on this!  Question regarding this:
>>
>> > Object.extend(..., options || {}) // Extend the object created about
>>
>> Is it necessary to || {} (empty object) so as to not break the
>> Object.extend in the event that options is null?
>>
>> Karl..
>>
>> On Aug 31, 10:19 am, Richard Quadling  wrote:
>>
>>
>>
>> > On 31 August 2010 17:49, kstubs  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: ">", 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.
>
>

As I understand things, Prototype's Object.extend, when related to
elements, is using the DOM names and not the HTML names.

They are different. You have to learn them, sorry.

name is an attribute on  elements (input, select, textarea,
buttons, etc. - is there an etc. ? ).


There are many online references. I like the SitePoint ones
http://reference.sitepoint.com/css,
http://reference.sitepoint.com/html,
http://reference.sitepoint.com/javascript.




-- 
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: Object extend magic

2010-09-01 Thread Richard Quadling
On 31 August 2010 19:20, kstubs  wrote:
> Thanks Richard for your answer on this!  Question regarding this:
>
>> Object.extend(..., options || {}) // Extend the object created about
>
> Is it necessary to || {} (empty object) so as to not break the
> Object.extend in the event that options is null?
>
> Karl..
>
>
> On Aug 31, 10:19 am, Richard Quadling  wrote:
>> On 31 August 2010 17:49, kstubs  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: ">", 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.
>
>

The Object.extend code doesn't validate the options. So, if null is
supplied, this would result in an 'undefined' error.

Considering that in most cases you'd be extending an object with
something, rather than simply subclassing it with no additional
properties/methods, then the code is tuned to the most common use
case.

Using 'options || {}' simply turns the code into a common form.


-- 
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  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: ">", 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.



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

2010-08-31 Thread Richard Quadling
On 31 August 2010 15:17, Johan Arensman  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.




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



[Proto-Scripty] Parameters whose intent is to identify elements.

2010-08-27 Thread Richard Quadling
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.

-- 
You received 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  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 24 August 2010 16:23, Richard Quadling  wrote:
> On 22 August 2010 14:52, johnwerry  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]|/)))/,'#{0}');
>>
>> 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,
'$&');

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.



Re: [Proto-Scripty] Javascript + regex

2010-08-24 Thread Richard Quadling
On 22 August 2010 14:52, johnwerry  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]|/)))/,'#{0}');
>
> 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 22 August 2010 14:52, johnwerry  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]|/)))/,'#{0}');
>
> 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.



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

2010-08-19 Thread Richard Quadling
On 19 August 2010 12:33, Richard Quadling  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] Dragging '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.



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  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  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 wrote:
>>
>>
>>
>> >  On 17 August 2010 12:59, Phil Petree  wrote:
>> > > ===
>> > > HTML save as index.html:
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 
>> > >   Keyword
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 
>> > > 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() } );
>> > > }
>> > > 
>> > > 
>> > > 
>> > > ===
>> > > Serverside PHP save as add.php:
>>
>> > > Post Result:
>> > > 
>> > > ===
>> > > On Tue, Aug 17, 2010 at 7:30 AM, Richard Quadling 
>> > > wrote:
>>
>> > >> On 17 August 2010 12:01, Phil Petree  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>
>> >

Re: [Proto-Scripty] scriptaculous causes body background to fail on safari and chrome

2010-08-17 Thread Richard Quadling
On 17 August 2010 16:29, Richard Quadling  wrote:
> On 17 August 2010 16:13, Guillaume Lepicard
>  wrote:
>> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> http://www.w3.org/1999/xhtml";>
>> 
>> BG fail
>> 
>> body {
>> background-color: #00;
>> color:#ff;
>> }
>> 
>> 
>> 
>> 
>> 
>> Hello
>> 
>> 
>
> Oh strange.
>
> I've just loaded Safari V5.01 (7533.17.8) and got the same issue.
> White hello in a black banner. White remainder of page.
>
> Right click and choose inspect, background is now all black as expected.
>
> Works fine in Chrome V6.0.472.36 beta, IE 8 and FireFox V3.6.8
>
>
> --
> Richard Quadling.
>

Just in case there was anything I missed, I pasted the code into w3c's
validator. All OK.

On the surface of it, it looks like a webkit bug. What version of
Chrome are you using?


-- 
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] scriptaculous causes body background to fail on safari and chrome

2010-08-17 Thread Richard Quadling
On 17 August 2010 16:13, Guillaume Lepicard
 wrote:
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> BG fail
> 
> body {
> background-color: #00;
> color:#ff;
> }
> 
> 
> 
> 
> 
> Hello
> 
> 

Oh strange.

I've just loaded Safari V5.01 (7533.17.8) and got the same issue.
White hello in a black banner. White remainder of page.

Right click and choose inspect, background is now all black as expected.

Works fine in Chrome V6.0.472.36 beta, IE 8 and FireFox V3.6.8


-- 
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  wrote:
> ===
> HTML save as index.html:
> 
> 
> 
> 
> 
> 
> 
>   Keyword
> 
> 
> 
> 
> 
> 
> 
> 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() } );
> }
> 
> 
> 
> =======
> Serverside PHP save as add.php:
>
> Post Result:
> 
> ===
> On Tue, Aug 17, 2010 at 7:30 AM, Richard Quadling 
> wrote:
>>
>> On 17 August 2010 12:01, Phil Petree  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 
>> > 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  element with
>> >> all the 's needed.
>> >>
>> >> var tmpl_NewUser = new Template('> >> name="User[#{NewUserID}][Username]" value="" maxlength="200" size="50"
>> >> />> >> value="" maxlength="200" size="50" />> >> name="User[#{NewUserID}][PIN]" value="" maxlength="4"
>> >> />> >> name="User[#{NewUserID}][AllContracts]" value="1"
>> >> id="allContracts_#{NewUserID}" />> >> name="User[#{NewUserID}][ContactIDs]" value="" maxlength="200"
>> >> disabled="disabled" size="50" />> >> name="User[#{NewUserID}][ContactIDs]" value="">> >> class="vsaChooseContracts bold"
>> >> id="selectContracts_#{NewUserID}">Select
>> >> contracts> >> name="User[#{NewUserID}][Delete]" value="#{NewUserID}" />');
>> >>
>> >> 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.
>> >
>

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

2010-08-17 Thread Richard Quadling
On 17 August 2010 12:01, Phil Petree  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 
> 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  element with
>> all the 's needed.
>>
>> var tmpl_NewUser = new Template('> name="User[#{NewUserID}][Username]" value="" maxlength="200" size="50"
>> />> value="" maxlength="200" size="50" />> name="User[#{NewUserID}][PIN]" value="" maxlength="4"
>> />> name="User[#{NewUserID}][AllContracts]" value="1"
>> id="allContracts_#{NewUserID}" />> name="User[#{NewUserID}][ContactIDs]" value="" maxlength="200"
>> disabled="disabled" size="50" />> name="User[#{NewUserID}][ContactIDs]" value="">> class="vsaChooseContracts bold"
>> id="selectContracts_#{NewUserID}">Select
>> contracts> name="User[#{NewUserID}][Delete]" value="#{NewUserID}" />');
>>
>> 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.



[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  element with
all the 's needed.

var tmpl_NewUser = new Template('Select
contracts');

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.



[OT] Use the list properly. Please [WAS] Re: [Proto-Scripty] Re: 4 different browsers - 4 different responses

2010-08-17 Thread Richard Quadling
On 17 August 2010 07:32, Lapis  wrote:
> Oh hai ;)
>
> Interesting as it may be..
> does prototype.js or scriptaculous have anything to do Witherspoon
> this? Or did I just subscribe to some random HTML/HTTP chat?
>
> Sorry, getting morning coffee now...
>
> /P

No, you are right. I sometimes think that everything I do on the
client side is to do with Prototype.

The same argument was just raised at http://news.php.net/php.db/47310,
so it isn't just this list that suffers from subscribers having a
mental block on the reason for the list's existence.

Please accept my apologies.

As my school reports always said ... "Could try harder.".

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] Re: 4 different browsers - 4 different responses

2010-08-16 Thread Richard Quadling
On 14 August 2010 00:39, T.J. Crowder  wrote:
> Hi,
>
>> I know that target is a no-no for standards (and it seems IE is the
>> only one obeying it this time around!).
>
> How is `target` on an `a` element not standard?
> http://www.w3.org/TR/html5/links.html#attr-hyperlink-target
>

http://reference.sitepoint.com/html/a/target

says ...

"The target attribute is deprecated and its use as a layout mechanism,
like that of the frameset, is no longer common."

I want the PDF to NOT overwrite the current page. New tab, new window
or external app - any of these (in that order of preference).

But it seems I was testing the wrong code.

Doh!
-- 
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] 4 different browsers - 4 different responses

2010-08-13 Thread Richard Quadling
Hi.

I want to press a button to open a new tab showing a PDF file.

Currently, I have ...


View jobsheet


and each browser resulted in a different outcome (Chrome:new tab OK,
Firefox:2 new tabs both OK, IE:nothing, Safari:new window)


I know that target is a no-no for standards (and it seems IE is the
only one obeying it this time around!).

So.

How do I do this? The real url is supplied at runtime via an AJAX
request. I can assign it to whatever is needed.

I could just style the  as a button ... is that possible?

Any suggestions?

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

2010-08-05 Thread Richard Quadling
On 4 August 2010 18:20, Eric  wrote:
>
> On Jul 30, 1:26 pm, Richard Quadling  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] Re: Touch screen / mouse gesturing.

2010-08-05 Thread Richard Quadling
On 4 August 2010 18:08, Eric  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] Form.serialize and unchecked checkboxes

2010-08-01 Thread Richard Quadling
On 30 July 2010 18:56, strimp099  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:
>
>  checked="checked" />
>  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  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 21 July 2010 13:10, Richard Quadling  wrote:
> On 20 July 2010 23:37, Febo  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  wrote:
>>> On 20 July 2010 17:59, Ralph Brickley  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 >> > 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  wrote:
>>>
>>> >> On 20 July 2010 15:55, Febo  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] Re: Effect.multiple and toggle

2010-07-21 Thread Richard Quadling
On 20 July 2010 23:37, Febo  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  wrote:
>> On 20 July 2010 17:59, Ralph Brickley  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 > > 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  wrote:
>>
>> >> On 20 July 2010 15:55, Febo  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: not send data in URL?

2010-07-20 Thread Richard Quadling
On 20 July 2010 20:58, geoffcox  wrote:
>
>> You could have to create a form with am  for each
>> unit and folder and a bit of JS to turn an  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] Effect.multiple and toggle

2010-07-20 Thread Richard Quadling
On 20 July 2010 17:59, Ralph Brickley  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  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  wrote:
>
>> On 20 July 2010 15:55, Febo  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] Effect.multiple and toggle

2010-07-20 Thread Richard Quadling
On 20 July 2010 15:55, Febo  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] not send data in URL?

2010-07-20 Thread Richard Quadling
On 20 July 2010 06:24, geoffcox  wrote:
> Hello
>
> I have this php code
>
> for ($count=0;$count echo " target='content'>BTEC First - Unit " . $units[$count] . "\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  for each
unit and folder and a bit of JS to turn an  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] 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  wrote:
> yes
>
> On Jul 16, 8:42 pm, Richard Quadling  wrote:
>> On 16 July 2010 07:37, Quyết Tiến  wrote:
>>
>> >  rel="dhtmlwindow">content
>>
>> Is that a typo?
>>
>> content
>
> --
> You received 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  wrote:
>  rel="dhtmlwindow">content

Is that a typo?

content

-- 
You received 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  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  wrote:
>
>
> On Jul 13, 11:44 am, Richard Quadling  wrote:
>> On 13 July 2010 10:59, Lemmi  wrote:
>>
>> > On Jul 13, 11:28 am, Richard Quadling  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] Re: .innerHTML Undefined form name error

2010-07-13 Thread Richard Quadling
On 13 July 2010 10:59, Lemmi  wrote:
> On Jul 13, 11:28 am, Richard Quadling  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] Re: .innerHTML Undefined form name error

2010-07-13 Thread Richard Quadling
On 13 July 2010 10:10, ColinFine  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 
> 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] .innerHTML Undefined form name error

2010-07-13 Thread Richard Quadling
On 12 July 2010 18:02, Hariz Soleminio  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 

-- 
You received 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  wrote:
> On 2 July 2010 11:22, Alex McAuley  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" 
>> To: 
>> Sent: Thursday, July 01, 2010 11:57 PM
>> Subject: Re: [Proto-Scripty] Sorting some spans.
>>
>>
>>> On 1 July 2010 21:28, Alex McAuley 
>>> 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] Re: Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 09:34, T.J. Crowder  wrote:
> Hi Richard,
>
>> I've got a  containing a set of 
>> 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:
>
>    Label text
>
> 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.



  1   2   3   >