prototype-scriptaculous@googlegroups.com

2009-07-22 Thread ColinFine



On Jul 21, 1:52 pm, "Alex McAuley" 
wrote:
> Each to their own, everyone has their own coding practices and concepts.
>
Indeed. I'm not about to start using '.' or ':' in ID's myself.

> In PHP and Perl you -could- call "." a heirachial operator as it joins 2
> nodes (strings for example) together - thus jumping from one to the next or
> making the bridge (to assimilate them) - which is what it does in Javascript
> for example (kind of).

I think this is a perverse argument, but I'm not going to get excited
about it.

> As i said - each to their own but if CSS explicits ".className" as a
> classname then perhaps they should think about not having dots in ID's
> ([0-9Aa-Zz]\-_) would be a better fit for DOM element id's in my opinion.
> Classnames do not allow dots as far as i know. I would've thought the devs
> of JS libraries wluld have realised that perhaps 0.01% of javascript
> developers in the world would use dots and possibly didnt want the
> performance lack to accomodate these users  Just my 2 pence worth!!!
>
I think, as Rick implied above, that the designers of CSS selectors
were ill-advised to use symbols which were permitted in id's (I'm
assuming that the HTML spec came before the CSS one, but I haven't
checked). But formally, there are no contexts in which these are
ambiguous.

But I think it would be wrong for JS libraries to refuse to work just
because you had made certain (valid) choices in your HTML.
(OTOH I wish that browsers and libraries would object to a very common
instance of invalid HTML: duplicate id'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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Need help for performantly creating tooltips

2009-07-22 Thread ColinFine



On Jul 21, 10:00 pm, Diodeus  wrote:
> "Performantly" isn't a word.
>

Prove it.

Hint: you can't.
There is no test that you can apply which will establish that this
isn't a word. Furthermore, it is perfectly understandable.

This kind of ill-informed pedantry is annoying at the best of times.
Here, where it was a) off-topic, b) unhelpful and c) addressed to a
non-English speaker, it verged on the offensive..

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



[Proto-Scripty] Re: Parsing XML

2009-07-22 Thread ColinFine



On Jul 22, 6:48 am, ferion  wrote:
> Olla,
>
> is there nobody out there who is able to help me out?
> If i'm posting in the wrong forum or if my question is stupid like
> shooting in your own foot, please tell this to me.
>
> I'm realy clueless.
>
> Ferion

I'm sorry, I have never (well, not since my very first attempt)
returned XML from an Ajax call. JSON is much easier to handle.

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



[Proto-Scripty] Re: IE8 invalid argument line 4501

2009-07-24 Thread ColinFine



On Jul 23, 12:28 pm, Jeff  wrote:
> We've having this exact error with IE8 and it's always related to
> developers using element IDs that begin with non-Alpha characters.
> Doing something like adding and underscore to the id fixes the
> problem.
>

Note that an underscore is not a permissible first character of an ID
in the HTML spec etiher. An ID must begin with a letter.


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



[Proto-Scripty] Re: get controls array

2009-07-24 Thread ColinFine



On Jul 24, 1:02 am, diegoturriaga  wrote:
> Well... first that all thanks for your reply!
>
> I'm trying to use a multidemensional javascript array... various
> arrays of input controls of type checkbox
>
> I have 10 controls with name "myarray[1][]"
> other 10 controls with name "myarray[2][]"
> other 10 controls with name "myarray[3][]"
> ...
> other 10 controls with name "myarray[n][]"
>
> And I need get al controls named iqual in an array var... something
> like:
>
> var aux = document.getElemntsByName('myarray[1][]`);
>
> but using prototype sintax... :)
>
I'm not sure if you are under a misapprehension.

The value of a 'NAME' property in HTML is a CDATA - a string of text.
It has no structure.
You are free to call an input "opt[0][]" but that is a text string,
not any kind of an array in any language.
(PHP kindly treats inputs with [] in their names specially, but that
is the server-side program, not anything to do with the page or
javascript: I don't know whether any other server-side languages do
this).

So if you want to use prototype (or any other javascript) to
manipulate these names, you must treat them as text: match them as
text, perhaps even 'eval' them. But they are not arrays in any way.

As Matt says, the nearest you can get to this in Prototype is by using
the =~ match in a CSS selector, but that will not necessarily do what
you need. Otherwise you will have to do basic Javascript text
matching, or use the suggestions others have made.


(It may be that you already understand the point I am making, in which
case, my apologies).

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



[Proto-Scripty] Re: Manipulating the ghostly Clone

2009-07-29 Thread ColinFine



On Jul 28, 5:06 pm, ferion  wrote:
> Hello everybody,
>
> another day - another problem :)
>
> Due to the design of my project it is nessesary to manipulate the DOM-
> Structure of the ghost created by the new Draggable function
> "ghosting:true"
>
> like in
> this.Dragger = new Draggable($(this.widgetToolId),{revert:
> this.shallIToolRevert.bind(this), onStart:this.startDrag.bind(this),
> onEnd:this.stopDrag.bind(this), onDrag:this.whileDrag.bind(this),
> ghosting:true, starteffect:null});
>
> The ghosting works fine, but it seems to be a perfect Clone of the
> original Div (including the ID which is quite strange because the
> shall be no ambigious id in one page).
> I worked some time on this Problem but every manipulation ($
> (dragname), Dragger.element) targets the original div an not the
> clone.
>
startDrag uses Node.cloneNode, which does not know anything about 'id'
properties or their uniqueness.

I think that HTMLElement ought to have its own.cloneNode method,
overriding Node.cloneNode and unsetting the 'id' property, because
otherwise it *usually* generates invalid HTML; but unfortunately there
is no override. (I would say this is a bug in the DOM Level 2 HTML
spec, but I guess you can argue that the element is not invalid, just
inserting it in the same document is invalid - and again you do that
by methods of Node not of HTMLElement.)

Given this, I would say it is a bug in startDrag that it inserts a
probably illegal element .

I can't think of a way round this in your code, but you could hack
dragdrop.js thus (untested)

 startDrag: function(event) {
this.dragging = true;
if(!this.delta)
  this.delta = this.currentDelta();

if(this.options.zindex) {
  this.originalZ = parseInt(Element.getStyle(this.element,'z-
index') || 0);
  this.element.style.zIndex = this.options.zindex;
}

if(this.options.ghosting) {
  this._clone = this.element.cloneNode(true);
// Add this line:
  this._clone.id = this.element.id + '_ghost';
// or this one:
  this._clone.id.addClassName('ghost')
//
  this.element._originallyAbsolute = (this.element.getStyle
('position') == 'absolute');
  if (!this.element._originallyAbsolute)
Position.absolutize(this.element);
  this.element.parentNode.insertBefore(this._clone, this.element);
}

etc.

Then if you use the first method, you can use $(this.widgetToolId
+'_ghost') to refer to the ghost. In the second case, use $$('.ghost')
[0]/

Further thoughts on cloneNode etc (not directly relevant to the
question):

An Element.cloneNode (overriding Node.cloneNode) could remove the id:
this would always be legal, and very often necessary for legality - it
is unlikely that you will clone a node but not insert it in the
document. A more helpful alternative would be to let Element.cloneNode
to take an optional 'id' argument, which it would substitute for the
original id in the clone.
To catch it at the point at which the illegality is committed, you
would need to override Note.insertBefore etc with Element.insertBefore
etc. But at this stage the method has no idea that it is a clone it is
adding, so the only check it can make is to do a
document.getElementById to see if the id already exists - which might
be expensive.
On the other hand, there is a case for saying that
Element.insertBefore *should* make this check anyway, irrespective of
whether node being added is a clone or not. Of course  that would
break an awful lot of websites ... :-)



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



[Proto-Scripty] Re: Manipulating the ghostly Clone

2009-07-29 Thread ColinFine



On Jul 29, 4:12 pm, ferion  wrote:
> Olla,
>
> all praises to Mr Fine :)
> You pointed me in the right direction. I found a workaround, which is
> fishy but works in IE7+8 and FF2+3
>
> function getGhost(objectId)
> {
>         var helper = $(objectId); // Das ist das Orginal
>         helper.setAttribute("id","isGhosted");
>
>         var ghost = $(objectId); // Der Ghost
>
>         var helper = $("isGhosted");
>         helper.setAttribute("id",objectId);
>
>         return ghost;
>
> }
>
> The idea is simple. I catch the Element by Id (which is always the
> original) and alter the id. The second call returns the ghost, 'cause
> now ist's the only element with this id.
> To clean up you just have to reset the id to the original and return
> the pointer to the ghost

Well done. The trouble is, that it depends on undocumented browser
behaviour - there is no guarantee that $(objectid) will pick up the
original.

Colin

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



[Proto-Scripty] Re: how can i implement rails' link_to_remote :submit options using Ajax.updater?

2009-08-03 Thread ColinFine



On Aug 1, 4:23 pm, serenobs  wrote:
> Hello.
>
> <%= link_to_remote 'click here', :update=>'some_div', :url=>
> {:action=>'some'}, :submit=>'group' %>
> is what I want to implement using  Ajax.updater.
>
> To do this I coded ( it is invoked when I clicked some link or button,
> whatever )
> new Ajax.Updater('some_div', url(:action=>'some'),
>       { parameters: $('group').serialize(true), method: 'get'} );
>
> group div looks like below:
> 
>   <%= radio_button_tag(:myvalue, 1 %>
>   <%= radio_button_tag(:myvalue, 2 %>
> 
>
> on the controller's 'some' looks like below
> def some
>    if params[:myvalue] == blah blah
> end
>
> if i use link_to_remote with submit options, it worked properly.
> but in case of my code using Ajax.updater, params[:myvalue] is not set
> properly.
>
> What's wrong with me?
> Somebody help me.
>
This is a Prototype/Scriptaculous group, not a Rails one. There might
be people here who read Rails, but you will probably get more success
if you post the Javascript which is actually received by the browser,
rather than the Rails source.


> 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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Class with Ajax and onclick event

2009-08-05 Thread ColinFine



On Aug 4, 2:24 pm, Liviu Timar  wrote:
> var Dynamic = Class.create({
>         initialize: function(selector, container, script)
>         {
>                 this.selector  = selector;
>                 this.script    = script;
>                 this.container = container;
>
>                 this.changeContent = 
> this.changeContent.bindAsEventListener(this);
>
>                 this.getContent();
>         },
>         getContent: function()
>         {
>                 new Ajax.Request(this.script, {
>                         onSuccess: function(req)
>                         {
>                                 this.content = req.responseJSON;

This is ths problem. Inside the function definition, there is a new
scope, and 'this' will not have been assigned (because callbacks don't
get called as methods).

Either you need to #bind your onSuccess function, or I would just use
another variable:

getContent: function()
{
   var that = this;
   onSuccess: function(req)
   {
   that.content = req.responseJSON;
...

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



[Proto-Scripty] Re: help with select on element not working

2009-08-18 Thread ColinFine



On Aug 10, 3:53 pm, molo  wrote:
> Thanks so much T.J., that was the problem. I never would have gotten
> that
>

Incidentally (and not on topic for your question)

is not valid in either HTML or XHTML.

Also,  does not have a 'type' attribute. I believe browsers
generally do let you set an arbitrary attribute (though I haven't
found anything in the HTML spec that explicitly permits it), but it
seems an odd thing to do: did you mean to say 'class="text"'?

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



[Proto-Scripty] Re: Sortable.create and onHover

2009-08-18 Thread ColinFine



On Aug 10, 9:57 am, Sebastien  wrote:
> Ok, thanks, but how would you implement my code then?
> Do I have to overload the whole Sortable.onHover method?
> If yes, then every new Sortable created will call the onHover method
> isn't it? I would like it to be called only for this Sortable, not all
> of them.
>
You write your own 'onHover' function and pass it as the 'onHover'
argument to the Sortable.

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



[Proto-Scripty] Re: Observing a checkbox

2009-08-18 Thread ColinFine



On Aug 13, 2:53 pm, Jeztah  wrote:
> What is the correct Cross browser way to observe a checkbox being
> checked or not
>
> I am using
>
> $('hidenonlive').observe('change',function() {
>
>                                 if($('hidenonlive').checked!==true) {
>                                         alert('Showing');
>
>                                 } else {
>                                         $$('.dead-vacancy').invoke('hide');
>
>                                 }
>
>                         });
>
> But it doesnt seem to want to work in IE8 and it doesnt throw an
> error SHoudl i just use "click" instead?
>
You are tabbing to a different field after clicking, yes?

The definition of 'onChange' in the HTML spec (http://www.w3.org/TR/
html401/interact/scripts.html#adef-onchange) is "The onchange event
occurs when a control loses the input focus and its value has been
modified since gaining focus".

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



[Proto-Scripty] Re: Ajax.InPlaceEditor in tables in IE6

2009-08-18 Thread ColinFine

> - First case, using a div container (*) : Works as expected on IE8 and
> FF but on IE6 you have to click on the actual text to activate InPlace
> editing.
> (*) I am aware it is bad to put divs in tables, but so far that's the
> best working option :o(

What's wrong with putting divs in tables (inside the table cells, of
course)?

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



[Proto-Scripty] Re: Dropping

2009-08-18 Thread ColinFine



On Aug 14, 1:32 pm, Floyd Resler  wrote:
> I think you're right on that.  I should have expanded my question.  If  
> the object isn't dropped on a Droppable object, how do I get it to go  
> back to its original position?  I tried setting revert to true but the  
> object always goes back.
>
I found this a problem too.

What I did was to use revert, but in my onDrop I would hide the
object. There would be a moment when it vanished before the Ajax
redisplayed it, but I thought that was better than having it revert
until the Ajax redisplayed it.

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



[Proto-Scripty] Re: Sortable onUpdate firing at the wrong time

2009-08-18 Thread ColinFine



On Aug 16, 7:50 am, JoJo  wrote:
> I think I figured it out. The callback must not have parentheses.
>
> FAIL:    onUpdate: someFunction();
> GOOD: onUpdate: someFunction;
>
> I have no idea why.  I am a beginner to JS.
>
Because "onUpdate: someFunction()" means "Call 'someFunction' and make
its return value the value of 'onUpdate'", whereas
"onUpdate:someFunction" means "Make the function 'someFunction' the
value of 'onUpdate'".

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



[Proto-Scripty] Re: help with select on element not working

2009-08-19 Thread ColinFine



On Aug 18, 4:47 pm, "T.J. Crowder"  wrote:
> Colin,
>
> > Incidentally (and not on topic for your question)
> > 
> > is not valid in either HTML or XHTML.
>
> It's valid XHTML for an empty table cell.
>

Wrong. It's a common misconception (which I had myself until
recently).

"All elements other than those declared in the DTD as EMPTY must have
an end tag. Elements that are declared in the DTD as EMPTY can have an
end tag or can use empty element shorthand (see Empty
Elements)." (http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-4.3)

That is, elements DECLARED TO BE EMPTY may use the shorthand. Elements
which happen to have no content may not.

I discovered this when Firefox correctly objected to  or
something when I had given it an XTHML-Strict DOCTYPE.

> > Also,  does not have a 'type' attribute. I believe browsers
> > generally do let you set an arbitrary attribute (though I haven't
> > found anything in the HTML spec that explicitly permits it)...
>
> It is in fact verboten.  

Is it? I couldn't find an explicit statement that only the defined
attributes were permitted, though it is implied (and I thought I had
found somewhere in the HTML spec where it referred to 'attributes
defined in this specification', which might be taken to imply that
other attributes were permitted; but I can't find that now).

In HTML5, though, we're allowed to use our
> own attributes as long as their names start with "data-", e.g.:
>
>     
>
> ...is valid but
>
>     
>
> ...is not.

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



[Proto-Scripty] Re: help with select on element not working

2009-08-20 Thread ColinFine



On Aug 20, 9:39 am, "T.J. Crowder"  wrote:
> Hi Colin,
>
> > > > Incidentally (and not on topic for your question)
> > > > 
> > > > is not valid in either HTML or XHTML.
>
> > > It's valid XHTML for an empty table cell.
>
> > Wrong. It's a common misconception (which I had myself until
> > recently).
>
> If so, it's a misconception the W3C's own validator shares.

You're right. How bizarre. The spec clearly says no.

I'm sure I discovered this restriction because Firefox objected once,
but I can't think in what context.

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



[Proto-Scripty] Re: help with select on element not working

2009-08-20 Thread ColinFine



On Aug 20, 9:39 am, "T.J. Crowder"  wrote:
> Hi Colin,
>
> > > > Incidentally (and not on topic for your question)
> > > > 
> > > > is not valid in either HTML or XHTML.
>
> > > It's valid XHTML for an empty table cell.
>
> > Wrong. It's a common misconception (which I had myself until
> > recently).
>
> If so, it's a misconception the W3C's own validator shares.

Apologies - I was wrong. After discussion with somebody from W3C I now
understand that the section I was quoting is informative not
normative. I do think that it is misleading however (and I'm sure I
discovered this apparent limitation when something - I thought it was
firefox - threw out a construct like ).

Both the XML and XHTML specs recommend not using the short form for
elements which are not defined as EMPTY, but they do not forbid it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: effect.multiple and effect.scale

2009-08-21 Thread ColinFine



On Aug 20, 12:18 pm, blr21560  wrote:
> Hi,
>
> I run this line :
>         Effect.multiple( tab, Effect.Scale);
>
> There are no effect.
> tab is an an array with two div elements.
>
> I run this line
>         Effect.multiple( tab, Effect.Fade );
>
> It's ok;
>
> Why ?
>
Same as Mojito's question above:

Effect.Scale is a 'core Effect' and invoked using "new Effect.Scale"
Effect.Fade is a 'combination Effect' and invokde usinjg "Effect.Fade"

Like TJ, I am not familiar with effects, so I don't know why there is
this difference.

Unfortunately the documentation page doesn't give any examples of
using Effect.multiple with core effects. This may be a bug, or you may
need a different syntax. My guess is that you would have to wrap the
constructor in an anonymous function:

Effect.multiple(tab, function(e) {new Effect.Scale(e)});

but I may be way off beam here.

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



[Proto-Scripty] Re: How do I use AjaxRequest to POST checkboxes which is an array, not a variable?

2009-08-24 Thread ColinFine



On Aug 22, 5:09 pm, desbest  wrote:
> How do I use AjaxRequest to POST checkboxes which is an array, not a
> variable?
> [code]
> =
> 
>
>         function addEvent(day, month, year, body, involved) {
>                 if(day && month && year && body && involved) {
>
>                          //alert('Add Event \n Day: '+day+'\n Month: 
> '+month+'\n Year:
> '+year+'\n Involved: '+involved+'\n Body: '+body);
>
>                         new Ajax.Request('rpc.php', {method: 'post', postBody:
> 'action=addEvent&d='+day+'&m='+month+'&y='+year+'&involved='+involved
> +'&body='+body+'', onSuccess: highlightEvent(day)});
>
>                         $('evtBody').value = '';
>                 } else {
>                         alert('There was an unexpected script error.\nPlease 
> ensure that
> you have not altered parts of it.');
>                 }
> 
> 
> [/code]
>
> It posts information using ajax but the rpc.php thinks that $involved
> equals 1.
> What it doesn't know is that $involved is an array, which when echoed
> reads Array because it has $involved[0] and $involved[1]. Below is
> rpc.php for a calendar script.
>
> [code]
> ===
>                 $day = $_POST['d'];
>                 $month = $_POST['m'];
>                 $year = $_POST['y'];
>                 $body = $_POST['body'];
>                 $involved = $_POST["involved"];
>
>                 $howmany = count($involved);
>                 $timeStamp = mktime(0,0,0, $month, $day, $year);
>                 $bodyF = addslashes(trim($body));
>
>                 $addEvent = mysql_query("INSERT INTO event (body, timestamp, 
> userid,
> involved) VALUES ('$body', '$timeStamp', '$logged[id]', '$howmany')",
> $conn);
>
>                 $daidting = mysql_insert_id();
>                 $addInvolved = mysql_query("INSERT INTO involved (eventid, 
> userid)
> VALUES ('$daidting', '$howmany')", $conn);
>
>                 foreach ($involved as $f) {
>                 //echo $f."";
>                 $addInvolved = mysql_query("INSERT INTO involved (eventid, 
> userid)
> VALUES ('$daidting', '$f')", $conn);
>                 }
>
> ===
> [/code]

CGI has no concept of an array, even in POST. You either need to
serialise the array, or generate multiple instances of
"involved=whatever".

PHP has a nifty wrinkle whereby if a control in your page has a name
ending in '[]' then it will give you back an array.

BUT, where checkboxes are involved, I don't think an array is useful,
because the wonderful design of HTML returns absolutely nothing for an
unchecked box, so if you simply try to pass all the checkboxes back to
your CGI program you will get only the checked ones with no indication
of which boxes on the page they were.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How do I use AjaxRequest to POST checkboxes which is an array, not a variable?

2009-08-26 Thread ColinFine



On Aug 24, 1:15 pm, Richard Quadling  wrote:

> Extending upon what ColinFine said about the use of [], this can be
> useful when using checkboxes when the [] contains, say, an id or when
> the input tag's value is set.
>
> e.g.
>
> 
>
> or
>
> 
>
> The first would produce and array ...
>
> Array
> (
>     [Monday] => 1
> )
>
> The second would produce an array ...
>
> Array
> (
>     [0] => Monday
> )
>
Thanks, Richard, I hadn't thought of those approaches.

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



[Proto-Scripty] Re: $H need help

2009-08-26 Thread ColinFine



On Aug 26, 1:09 am, buda  wrote:
> I need to put into hash pairs:
>
> input1.id : input1.getValue
>     
> inputN.id : inputN.getValue
>
> where N may be from 5 to 25
>
In that case, update is the right tool, and I can't see anything wrong
with your initial syntax. Could the error be somewhere else? Or might
you have a stray comma at the end of your object ("h.update
({ input.id: input.getValue(), });")?  (IE objects to that, rightly,
but Firefox is more forgiving).

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



[Proto-Scripty] Re: clonePosition not behaving accurately on spans

2009-09-04 Thread ColinFine



On Sep 4, 3:59 am, Tiago  wrote:
> This may not be Prototype's fault after all. I made a very simple test
> now. I compared the rendering of two pieces of HTML code separately:
>
> (1)
> 
> 
> 
>
> (2)
> 
> 
> 
>
> I measured both inputs with a "pixel ruler" and I realized their
> rendering is identical. Not a single pixel of difference. In both
> cases, the distance between the top of the browser window and the top
> of the input is 8 pixels.
>
> Then, I used a native method to obtain the position from the top:
>
> document.getElementById('test').offsetTop
>
> In case (1), the command returned 11 pixels. In case (2), the command
> returned 8 pixels.
>
> For some reason, the browser reports a wrong offsetTop when a span is
> used (even though the element is properly placed). Because Prototype's
> implementation of the clonePosition method relies on such values, the
> end result is inaccurate. Any thoughts why this happens?
>
> My tests were performed in Firefox 3.5.2.

If you can work out what should happen from the CSS spec [1] you're a
better man than I am. But I note that the 'visual formatting model'
distinguishes inline from block elements, so it is not necessarily to
be expected that they would be positioned identically.

[1] http://www.w3.org/TR/CSS21/visudet.html#Computing_heights_and_margins

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



[Proto-Scripty] Re: clonePosition not behaving accurately on spans

2009-09-07 Thread ColinFine



On Sep 5, 1:38 am, Tiago  wrote:
> ColinFine,
>
> I couldn't find anything relevant in the spec either. However, my
> point is not whether or not the elements are being positioned
> identically. It's whether the position reported by the browser is in
> fact the rendered position. As far as I understand, it's this apparent
> incoherence that causes clonePosition to behave improperly.
>
My point was that it is possible that even though an inline element
and a block element appear to be at the same position, it might be
that their actual position values will not agree, because of the
different positioning models. I don't know if this could occur or not.

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



[Proto-Scripty] Re: Sortable.create & reverteffect

2009-09-14 Thread ColinFine



On Sep 11, 2:19 am, "Jon B."  wrote:
> I'm trying to use the reverteffect option on a sortable and it's not
> doing what I would expect. My expectation is that the reverteffect
> would only be triggered if the object I'm dragging is dropped back
> where it started. What I'm seeing is that the reverteffect is
> triggered regardless of where I drop the object. I'm including a
> simple example below.
>
I havent' used reverteffect or sortable, but I've used revert on
draggable, with a similar result.

It appears that it reverts irrespective of whether the drop succeeded
or not.

What I have done is to hide the dragged element when the drag
succeeds, so that the revert is not visible. In my case, the dropsite
is then regenerated in Ajax, so there is a brief moment when the
element has disappeared, and then it appears again in its new home. I
don't know if your instance could work that way.

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



[Proto-Scripty] Re: working with google maps and onComplete

2009-09-14 Thread ColinFine



On Sep 11, 3:33 pm, wilkinsmd  wrote:
> Hi, I'm new to prototype.js and have a question.
>

>
> Now here's my issue:  Utilizing prototype.js, I use ajax.request to
> call the perl script, and use "onComplete" to turn off the
> "Querying..." message.  But at the time when it turns that off, it
> still needs to put the points on the map.  That is handled by another
> javascript function which calls GDownloadUrl, and takes more time
> (depending on the number of points).  I'd like to wait until that
> completes to turn off the "Querying..." message.  BUT, ajax.request
> can only be used when calling a URL to generate some data, and as far
> as I know, not when simply running a javascript function I have
> defined on my page.  And since I can't use ajax.request to place the
> map points, I can't use onComplete and thus the "querying..." message
> is turned off too early.  Not interested in simply adding a
>
> Does anyone have any ideas on how this can be accomplished?
>

You haven't explained how GDownloadUrl gets fired, but essentially you
need
GDownloadUrl to remove the Querying message when it completes, rather
than
osComplete doing it.

How you tell GDownloadUrl about the message will depend on the
structure of your code and data.


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



[Proto-Scripty] Re: IE Add Observers in Reverse Order?

2009-10-12 Thread ColinFine



On Sep 29, 12:22 am, "T.J. Crowder"  wrote:
> Hi,
>
> There is no order guarantee in either case (MDC doesn't discuss order
> [1], MSDN specifically says it's random[2]).

And the W3C spec [1] specifically says it is left up to them:
"Many single modifications of the tree can cause multiple mutation
events to be fired. Rather than attempt to specify the ordering of
mutation events due to every possible modification of the tree, the
ordering of these events is left to the implementation."

[1] 
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-mutationevents

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



[Proto-Scripty] Re: Some basic basic stuff

2009-11-09 Thread ColinFine



On Nov 7, 9:45 pm, kstubs  wrote:
> Try naming the ID attribute different than the NAME attribute.
>

What difference would that make?

However, what I was going to suggest was checking that your id
'firstname' is unique in the page. Names can be duplicated, but id's
can't.

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



[Proto-Scripty] Re: Noob needs help with event handling

2009-11-09 Thread ColinFine



On Nov 6, 7:14 pm, Rhiq  wrote:
> I'll try to explain what I am up to; feel free to slap me if I am
> really messing this up.
>
> I have a table that represents orders in a database, and it seems to
> be working fine.  When the user clicks on an order a div is updated
> using an Ajax.updater call.  This works well, the information is some
> html code that gives details of the order.  It includes an edit link,
> and when the user clicks this another Ajax.updater updates the same
> div - this time with a form.  That seems to work will to.
>
> Here is the problem that I am running into.  When the submit button is
> clicked, I want the data to be saved and the div to by updated again
> with the refreshed order details.  I can't seem to come up with a way
> that works.
>
Do you mean that *instead* of doing an HTML submit (which always does
a GET or POST fetch of the whole page) you want to do an Ajax
operation which only refereshes the div?

In that case, don't use a 'submit' input at all: use a button (you can
call it 'submit' if you like) and observe it with a 'click'.
If you are concerned about getting all the inputs from from form, see
Form.serialize().

> The other question I have is how to attach an observer to a
> dynamically created element - like my form?
>
Either include some Javascript in the HTML you send from the Ajax
request, to set up an event handler (use Element.observe() rather than
the HTML 'onClick' property - in this case you will need to set
'evalScripts: true' in your Ajax.Updater options

Or, the better solution is to attache a handler to an element which
doesn't change (your  probably) and delegate handling.

If you say

$('mydiv').observe('click', function(ev) {
  var input = ev.findElement('input');
  if (input) ...

then any pick on your div, irrespective of how many times its contents
have changed, will call that function (which I've written inline, but
could be a named function), which will check whether the pick was
actually inside an  element - any  element - and if so
take action.

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



[Proto-Scripty] Re: Some basic basic stuff

2009-11-09 Thread ColinFine



On Nov 9, 7:04 am, Eugene Hourany  wrote:
> I never put in a name attribute, that could be part of the problem.
>
No.
>
> Now all I want to know is how to load and parse a JSON file using the same
> method.

What's a JSON file?

JSON is a text representation of data which is pretty well identical
to Javascript's own notation, so you can parse it with eval().
However, if the JSON is coming from Ajax, it's already available to
you as a parsed object: see http://www.prototypejs.org/api/ajax/response

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



[Proto-Scripty] Re: handler is undefined prototype.js handler.call(element, event) create wrapper

2009-11-11 Thread ColinFine



On Nov 9, 8:55 pm, jaikumar  wrote:
> Hi ,
>
>   I am getting " handler is undefined" error in  prototype.js  Fire
> Bug pointing to this method in prototype.js  handler.call(element,
> event) create wrapper.
>
>    Can any one help me to solve this bug.

Probably not, without more information.
If you asked me to guess, I would guess that you are passing a non-
existent function to 'observe'.
If you asked me to guess further, I would guess that you might be
writing a function call instead of a function,
so:

myelement.observe('click', myFunction);

sets 'myFunction' as the click handler for myelement, but

myelement.observe('click', myFunction());  //!!Almost always wrong!!

calls myFunction and sets the result (which is almost certainly not a
function) as the handler.

But I may be in completely the wrong area, since you haven't told us
anything about what you are doing.

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



[Proto-Scripty] Re: prototype 1.6.1, IE6: Object doesn't support this property or method, typeof Element=unknown

2009-11-13 Thread ColinFine



On Nov 11, 2:55 pm, Carsten  wrote:
> Hi,
>
> I used prototype 1.5.0rc2 and the testing tool Selenium 1.0 in a web
> application. When I updated prototype to 1.6.1, everything still works
> in FF 3.0, FF 3.5, IE7, IE8, but in IE6 I get strange javascript
> error messages:
>
> The code which fails is "Element.extent" in the function $().  The
> error message is "Object doesn't support this property or method".
>
> When I try to inspect "Element" in the debugger, I get the same error
> as above. When I evaluate "typeof Element", I get "unknown" (not
> "undefined").
>
Are you certain that the object has actually been created in the DOM
when you call this?

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



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

2009-11-17 Thread ColinFine



On Nov 16, 11:27 pm, phegaro  wrote:
> Hi all,
>   I have an app that is going to put out a list of items onto a page
> and each one has a number of click targets. Now i could setup the
> event handler in one of two ways.
>
> 1. add it into the template that is rendered with the following code
>
> Item Name 1
>
> or i could do the following
>
> 2. Add it using a selector and a script
>
> $$(".item").each(function(element){element.observe('click', doIt);});
>
> Are there any issues with option 1 or 2 and which is more performant
> and cross browser compatible. I think 1 is more performant but not
> sure it works in all browsers.

Generally, the recommendation is not to use the old 'onClick=' method
of event handling: I don't know how it compares for performance, but
it's certainly less flexible.

You can simplify your 2) slightly:

$$(".item").invoke('observe', 'click', doIt);

A third alternative is to use delegation:

$(document).observe('click', doIt);

and then make doIt determine what was clicked:
function doIt(e) {
  var item = e.findElement('.item');
 ...
}

This is particularly good if you are going to be adding items
dynamically when the page has already been loaded.

Colin Fine

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



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

2009-11-18 Thread ColinFine


On Nov 17, 10:17 pm, phegaro  wrote:
> Delegation sounds like a good model for doing this although if i want
> to pass parameters that are custom to each node like which id did it
> click on then i assume i have store it as a property on the node and
> pass arguments to the delgated function?
>
> In the above example if doIt took a paramter of the id to work on,
>
> doIt(id)  {
> // do something to the object with id X
> ...
>
> }
>
> Then with the delegation model i would have to retreive the node using
> findelement and then have an attribute on the node that held the id?
> Is that right?
>

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

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

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

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

 ...

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

or more generally

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

--

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




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

2009-11-19 Thread ColinFine


On Nov 18, 2:00 pm, Eric  wrote:
> Hi,
>
> I also think delegation is the better approach.
> However, I did notice that none of the examples was dealing with the
> case where the user click on something that is not a '.item'.
>
> You may want to do something like this:
>
> function doIt(e) {
>   var element = e.findElement('.item');
>   if(element != document)
>   {
>     var id = element.id;
>     // Do your stuffs here
>   }
>
> }
>

You're right - in fact, my example was wrong. I believed that
Event.findElement took a CSS selector, but it actually takes a
tagname, so e.findElement('.item') won't work.

Instead I would use

var element = e.element().up('.item').

which I think is easier than your suggestion.

--

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




[Proto-Scripty] Re: Accessing link_to_remote in controller with .find(params[])

2009-11-24 Thread ColinFine


On Nov 23, 5:51 pm, Blue Hand Talking  wrote:
> The following:
>
> <% @project_details.each do |project_detail| %>
>
> <%= link_to_remote ( :with => "'architect='+ #
> {project_detail.architect}") %>
>                                         <% end %>
> generates
>
> {asynchronous:true, evalScripts:true, parameters:'architect=' + 'Jack
> London ' + ...more stuff
>
> Is the above then available in params array in the controller, and if
> so how?
>
>  Right now I am trying:
>
>   �...@photos = Photo.find_by_architect(params[:architect:])
>
> which does not work.
>
This is a Prototype/Scriptaculous group, and you are asking about
something a server-side language (Ruby I guess?) which I don't know
anything about.

But what you pass in the 'parameters' comes in as the "search" part of
the URL (i.e. the bit after the ?). That is available to your server
program in the same way as the 'search' from any other URL.

--

You received this message because 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: event order part2

2009-11-30 Thread ColinFine


On Nov 27, 9:06 am, vtsuper  wrote:
> I have post a question 
> beforehttp://groups.google.com/group/prototype-scriptaculous/browse_thread/...
>
> I would like to solve this problem accroding to this 
> sitehttps://mootools.lighthouseapp.com/projects/2706/tickets/35-ie-s-atta...
> (this is mootools not prototypejs)
>
> but sadly it is not work in my case, does anyone know the reason???
> $('testobj').observe("widget:frobbed", function(){alert("1");});
> $('testobj').observe("widget:frobbed", function(){alert("2");});
> $('testobj').observe('click',function(){$('testobj').fire
> ("widget:frobbed", { widgetNumber: 19 }); });

I'm not clear what you are asking.

The _reason_ is as discussed in the previous thread: DOM Level 2 does
not guarantee the order of events, and it is implicit in the thread
that Prototype does not add anything to that.

Or are you requesting an enhancement to Prototype?

--

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




[Proto-Scripty] Re: document.write() vs Element/appendChild()

2009-12-07 Thread ColinFine


On Dec 4, 10:36 pm, fma  wrote:
> Ok, I found something...
>
> If I look at the HTML tree in the IE debugger, on the left panel I
> can't see any 'class' attribute. However, it does appear on the right
> panel (called Attributs), with the correct value. But IE does not
> seems to use it. I found that I can add an attribute to the div in the
> left panel. So I tried to add an attribute named 'class', and I set
> its value: this fixes the problem, and IE can apply the CSS!!!
>
> Then, I tried something else... I used the old-style to build the DOM
> tree:
>
>     this.content = document.createElement('div');
>     Element.extend(this.content);
>     this.content.setAttribute('id', this._name + "_content");
>     this.content.setAttribute('class', "fullContent");
>     document.body.appendChild(this.content);
>
I don't know if this is relevant to the problem, but you don't need to
use 'setAttribute' for built-in attributes of HTML element:

this.content.id = this._name + "_content";

avoids an unnecessary function call.

For the DOM attribute 'class', the Javascript binding requires you to
use 'className', because 'class' is a reserved word in Javascript:

this.content.class = "fullContent";

(or, using a Prototype method)
this.content.addClassName('fullContent');
This is not quite the same, because if you already have a class on the
element, this will add the new class, whereas the simple assignment
will replace it. But since you have just created the element, there is
no difference.

> instead of the new-style:
>
>     this.content = new Element('div', {'id': this._name + "_content",
> 'class': "fullContent"});
>
> and it worked!!!
>
> At first, I didn't put the quotes arround the attributes names, in the
> hash:
>
>     this.content = new Element('div', {id: this._name + "_content",
> class: "fullContent"});
>
> but IE does not like this syntax (it asks for an int or a string). But
> as you can see, giving a string does not seems to work well.

IE objects (correctly) to your using the Javascript reserved word
'class' as an object key: Firefox is more lax and lets it through.
'id' will work without quotes.
>
> Am I doing something wrong with the new-style method? Or is it a known
> issue in Prototype?
>
I don't know. Your example seems to match that in the Prototype
documentation. I would try it with 'className' instead of 'class' and
see whether this works.

--

You received this message because 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: self-or-ancestor in one whack?

2009-12-19 Thread ColinFine


On Dec 18, 5:51 pm, Walter Lee Davis  wrote:
> I use this construction quite a lot:
>
>         var elm = evt.element();
>         if(elm.tagName.toString().toLowerCase() != 'td') elm = elm.up('td');
>
> whenever I am constructing a rollover listener, since it works around  
> the whole issue with mouseover / out events firing whenever you move  
> over a child of the element you're trying to observe. Is there a  
> simpler way to do this, a more Prototype-y way, that is? I've had a  
> look around the API, and I also had a Google, but the former didn't  
> turn up anything useful and the latter turned up every commit message  
> from every project that includes Prototype.
>
I belive that is what Element.findElement is for.

Colin

--

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




[Proto-Scripty] Re: Finding the first form item of any type within a div

2010-01-07 Thread ColinFine


On Jan 6, 8:55 am, "Alex McAuley" 
wrote:
> $('mydiv').select('input','select')[0];
>
The OP has already said that that doesn't work, as he says it will
return the first  even if there is a  before that.

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




[Proto-Scripty] Re: Ajax Issue

2010-01-11 Thread ColinFine
Also, do you really mean to have & in your querystring?

>     if(!ajaxRequest('/chat.php?a=chat_post&m='+encodeURIComponent

& is HTML escaped. I think you mean & (an unescaped CGI
separator).

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




[Proto-Scripty] Re: script.aculo.us autocomplete: Restrict to list

2010-01-11 Thread ColinFine


On Jan 6, 10:38 pm, Strider  wrote:
> Has anyone implemented a restrict-to-list option in the autocompleter
> or know any of the pitfalls I should watch out for?
>
>  I would like to implement this option, for say State names, or such,
> and I would rather restrict to the list than doing post-selection
> error messages.  It seems like a feature that should be included (for
> things like state names, or other limited lists.)
>
> Does such a feature already exist (and I missed it in my search) or
> has anyone already implemented it?
>
> Thanks,
>
> StriderA

I don't follow. Your code has to provide the options which can be
offered in the Autocomplete, so can you not arrange to generate only
the restricted set you want?
-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Change variable value outside onSuccess

2010-01-11 Thread ColinFine

> When i call this function the return always false. Obviously because
> onsuccess create another function and it doesn't change the value of
> external variable.
>
> I'm asking for you guys if there's some way to change the value of
> variable logged based on the return of the ajax call? Or there's a way
> inside onSuccess to return the response to the caller function?
>

No, neither.

Your function userLogged has (in general) finished and returned before
the Ajax call returns - probably before it is even sent.

You need to restructure your code to take account of the asynchronous
nature of Ajax (don't be tempted to run it synchronously: this is a
bad idea).

Sorry.
-- 
You received this message because 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: ASP, MySQL, and Sortables

2010-01-14 Thread ColinFine


On Jan 13, 3:23 pm, vElentari  wrote:
> I'm learning ASP, MySQL, and javascript all crash-course style right
> now, so please forgive me ahead of time for my ignorance!  :)
>
> I'd like to use the Sortable feature on a page to reorder list
> elements.  The elements are in a MySQL database, and the site is ASP.
> I have a basic HTML table that displays the list now.  Each record
> contains the unique ID, the name of the element, a boolean value for
> whether the item should be Active or not, and an OrderBy field.  I'd
> like to hide that OrderBy field on the page, and instead of having the
> user manually reorder the list, use the sortable drag/drop feature.
>
> I'm just looking for sample code on using classic ASP with a MySQL
> database to grab the records, create the list and use scriptaculous to
> handle the reordering for the user, and then write the new order back
> to the database.
>
> I've found a bunch of examples out there of people using PHP and I'm
> sure I can figure it out but if I don't need to recreate the wheel...
>
If all you want to do is make your table sortable by the user, I would
suggest you don't use scriptaculous at all, but just look at Matt
Kruse's table.js (http:/javascripttoolbox.com/lib/table -I'm sure
there are other similar tools, but this is the one I have used). You
don't have to write any Javascript at all - you just give elements in
your table the right classes, and include table.js, and it does it all
for you.

Of course, if you want to do other whizzy things with Script.aculo.us,
then by all means use it :)
> Thanks
-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Update of 2 divs at same time

2010-01-18 Thread ColinFine


On Jan 14, 11:04 pm, nfuria  wrote:
> I have a page that shows a long table with the result of a ajax
> request.
> For design reasons, I want the header of the table to stay fixed when
> the body scrolls.
> To achieve this, I created 2 divs - one fixed and other normal.
> So, I need to  to update the 2 divs at same time and using the same
> url (a php file).
>
> For now I am using a function that do 2 updates calling the same php
> with a parameter that causes each response to be truncated to the
> desired content - only the head or only the body of the table:
> function gen_table {
>   var urlhead = 'search.php?res=head';
>   var urlbody = ''search.php?res=body';
>   new Ajax.Updater('divhead', urlhead);
>   new Ajax.Updater('divbody', urlbody);
>
> }
>
> It works, but can I use some other method to avoid the duplicate
> request?
>

As far as I know, you cannot use Ajax.Updater for this: you need to
use Ajax.Request and do the updating yourself.

What I have done in this case is to return a JSON object of the form:
{
  idoffirstdiv : htmltogoinfirstdiv,
  idofseconddiv : htmltogoinseconddiv
}

and then made my onSuccess function something like

var results = $H(response.getJSON());
results.each(function(pair) {
  $(pair.key).innerHtml = pair.value;
});


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




[Proto-Scripty] Re: Ajax.Updater problem with double quotes

2010-01-27 Thread ColinFine


On Jan 26, 3:41 am, Noppanit 
wrote:
> Hi guys,
>
> I'm not really sure if this is the problem of prototype. I'm using
> Ajax.Updater to update my table. But It was wired that when my table
> is updated, instead of my table would be
>
> 
> 
> 
>
> it went to
>
> 
> 
> 
>
Look at your Ajax code on your server. It must be sending the extra
quotes.

-- 
You received this message because 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: Why element never receives an event?

2010-02-02 Thread ColinFine


On Feb 1, 11:26 am, buda  wrote:
> how to register a handler for processing the message form its elements
> in right way?
>

If you want to trigger the event on updating any 'input' element on
the form:
form1.select('input').invoke('observe', 'update', function() { ... });

-- 
You received this message because 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: Why element never receives an event?

2010-02-03 Thread ColinFine


On Feb 2, 3:29 pm, buda  wrote:
> I need to receive message fired by form in forms element
>

If you mean that you want the input element to observe the user-
defined event,

form1.select('input').invokde('observe', 'form:updated',
function ... );

If that's not what you mean, I don't understand.

-- 
You received this message because 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: Problem with form fields that are arrays and .serialize()

2010-02-03 Thread ColinFine


On Feb 1, 12:44 pm, Siim  wrote:
> Hello.
>
> I have a form that has elements
>
>  id="add_article_link_url_list" value="1" />
>  id="add_article_link_desc_list" value="1" />
>
>  id="add_article_link_url_list" value="2" />
>  id="add_article_link_desc_list" value="2" />
>

In HTML the 'name' attribute is simply a CDATA - it has no inner
syntax.

As far as Javascript is concerned "add_article_link_url_list[2][link]"
and "add_article_link_desc_list[2][url]" are just two names which
happen to coincide except in a few characters.

It is I believe only PHP which treats [ ] in input names specially and
forms them into arrays.

Unless Prototype mimics this behaviour (and I don't think it does)
they will be treated as independent names. If you want to form objects
from them you'll have to parse them yourself (or maybe there are
Javascript libraries out there which will do it).

-- 
You received this message because 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: get a file from intranet server

2010-02-11 Thread ColinFine

> I apologize for the confusion.
> I like to download a file (C:\dir1\data.txt) from server (IP address
> 192.168.0.112) to my local machine which is running a Prototype
> javascript.
> How to do that?

The only way a session in your browser can access ANY resource from
the server is by firing off a new request - either a full page
request, or an Ajax request.

You probably want Ajax.Request (or Ajax.Updater if you're going to
display the file in your page); and  you need to write a server script
which will respond to the Ajax request and send the file contents.

Colin

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



[Proto-Scripty] Re: limit droppables

2010-03-29 Thread ColinFine


On Mar 28, 2:21 pm, HotShot  wrote:
> I would like to know if there is a way to limit a drop area to a
> certain number of items. When this limit is reached the drop area
> should no longer accept any draggables. Already dropped draggables
> should be removable from the drop area so that new draggable can be
> dropped.
>
> Is there a way to realize that?

Not automatically, as you are talking about behaviour that changes
between one drag and the next.

But it's not too hard to program it. What I would do is have a
function which examines the drop area and adds/removes a class 'can-
accept' depending on whether it is full or not.
Then set the 'accept' property in your Droppables call to 'can-
accept'.

You will presumably set the 'can-accept' class appropriately when you
first generate the page (or call the function to update it when you
have loaded the page), and call the function at the end of every
'onDrop'.

Removing an existing drop is something you will have to program
yourself.

-- 
You received this message because 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: I'm getting an error in line 599 of dragdrop.js

2010-04-07 Thread ColinFine


On Apr 6, 4:12 pm, HotShot  wrote:
> Hi,
>
> i created some sortable lists. Now I'm getting the error "element is
> null" in line 599 of the original dragdrop.js when a item from one
> list ist dropped into another. When I release the mouse button nothing
> happens. When I click it again the item droppes where it should drop.
>
> The code around line 599 would be:
>
> var Sortable = {
>   SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
>
>   sortables: { },
>
>   _findRootElement: function(element) {
>     while (element.tagName.toUpperCase() != "BODY") {
>       if(element.id && Sortable.sortables[element.id]) return element;
>       element = element.parentNode;
>     }
>   },
>
>   options: function(element) {
>     element = Sortable._findRootElement($(element));
>     if(!element) return;
>     return Sortable.sortables[element.id];
>   },
>
> ...
>
> Where as line 599 would be while (element.tagName.toUpperCase() !=
> "BODY") {
>
> Does anybody have an idea why this could be?
> Could it be, because the html tags for the sortalble divs are
> generated dynamically by  javascript?

This kind of error means that you are passing an element into one of
the Scriptaculous functions as null. This might be a simple error in
your programming but it is often because you are passing an element
which does not yet exist (perhaps because you have done some innerHTML
and not given the DOM time to operate.

Without more of your code, it's impossible to tell: but please don't
post a large amount: look at where the element values come from that
you are passing into Dragdrop functions.

-- 
You received this message because 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: Keypress for html select

2010-05-06 Thread ColinFine


On May 5, 2:48 pm, Walter Lee Davis  wrote:
> Doesn't the change event fire as soon as the select loses focus and no  
> longer has the same value it started with? I thought that was the  
> basis for the event itself. Can you post an example that fails to fire  
> the change event when modified with the keyboard?
>
Yes. This is the definition of onChange. See
http://www.w3.org/TR/html401/interact/scripts.html#adef-onchange

Colin

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



[Proto-Scripty] Re: changing value of select and implement the events of observer

2010-06-15 Thread ColinFine


On Jun 13, 11:53 am, josep  wrote:
> Hi.
>
> Sorry for my bad English level.
>
> I have a select like this:
>
> I want put the select into   to hide this. and
> with javascript to change manually the value of the select and execute
> the functions like the mouse.
>
> for example:
>
> $('attribue525').selectedIndex=2;
> $('attribue525').change= true
> //because I need to execute the event onchange --
>
> >Event.observe(element, 'change', this.configure.bind(this))
>
> anyone knows how to do this?

Why use an event? Why not
> $('attribue525').selectedIndex=2;
> $('attribue525').change= true
configureElement($('attribue525'));

?

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



[Proto-Scripty] Re: Hash cannot resolve variable as keys

2010-06-15 Thread ColinFine


On Jun 14, 10:18 pm, Ryan Gahl  wrote:
> On Mon, Jun 14, 2010 at 4:13 PM, JoJo  wrote:
> > this.field = new Hash({klass.staticVar: 999});
>
> js object literals don't resolve variables into keys this way.

Emphasising that this is nothing to do with Prototype: it is
Javascript syntax.

-- 
You received this message because 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: .innerHTML Undefined form name error

2010-07-13 Thread ColinFine
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?

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



[Proto-Scripty] Re: window.open on ajax response

2010-07-13 Thread ColinFine


On Jul 12, 5:31 am, Hari  wrote:
> But even this doesn't help since function call happens by a call back
> and not user action. So the browser popup blocker click in.
> One way i could think is make the Ajax call synchronous. But I think
> its not a great idea to make the Ajax call synchronous...

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

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

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

Colin

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



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

2010-07-14 Thread ColinFine


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

-- 
You received this message because 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: Targeting all elements

2010-07-16 Thread ColinFine


On Jul 12, 5:19 pm, Ryan  wrote:
> Here is what I want to accomplish. I have a page with a structure like
> this:
>
> 
>   Job Category Headline
>   
>     Job Title 1
>     
>         Details
>         Hide Position
> Details
>     
>     
>     Job Title 2
>     
>         Details
>         Hide Position
> Details
>     
>     
> 
> 
>
> Each job-info div is hidden using this:
>
> $$('.job-info').invoke('hide');
>
> So far so good. Now, I want to loop through all spans (#jobs ul li
> span) and add a listener for click. When the span is clicked, the job-
> info below it should display (just the one below, not all). In
> addition, within each div there is another div with a class called
> ".close" which should hide that parent div when clicked.
>
> It would appear that this is a simple task, but having never worked
> with prototype, what I've tried so far hasn't worked.
>
> If anyone could point me in the right direction, I'd appreciate it.
>
You _could_ set an observer on each span, but it's _much_ better to
set one on #jobs and delegate.

Something like (off the top of my head, so I'm sure it's not quite
right, but it should give you the idea.)

$('jobs').observe('click', function (e) {
  var span = e.findElement('span');
  if (span) span.show();
});

If there are other spans than these, you could put a class on them and
add it to the 'findElement'  argument.

> Thanks,
> Ryan

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



[Proto-Scripty] Re: IE problem

2010-07-16 Thread ColinFine


On Jul 12, 10:35 am, adglp  wrote:
> This code errors in IE. I get an invalid argument error concerning
> the  elementStyle object.
>
> The area that i'm interested in is: setStyle: function(element,
> styles) {
>     element = $(element);
>     var elementStyle = element.style, match;
>     if (Object.isString(styles)) {
>       element.style.cssText += ';' + styles;
>       return styles.include('opacity') ?
>         element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)
> [1]) : element;
>     }
>     for (var property in styles)
>       if (property == 'opacity') element.setOpacity(styles[property]);
>       else
>         elementStyle[(property == 'float' || property == 'cssFloat') ?
>           (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' :
> 'styleFloat') :
>             property] = styles[property];
>
>     return element;
>   },
>
> Please advise!!!

What styles are you passing? Do they include one that IE doesn't
support?

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



[Proto-Scripty] Re: Script.aculo.us + Prototype scripts not working on my server

2010-08-16 Thread ColinFine


On Aug 13, 6:43 pm, "chad.goodwin"  wrote:
> I was looking for a way to make an image scroller.
> I found Scriptaculous'   effect.move works very well.
> In fact I found a working example.
>
> So I went and downloaded the newest version from the Script.aculo.us
> site.
> I unzipped the files and uploaded them to my javascript folder.
> I copied the example code verbatim and it worked.
> However, I noticed the example code was linking 
> tohttp://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculou...
> I changed it to point to my scriptaculous.js in the javascript folder
> and it stopped working.
>
> I have checked that the files are there in the proper directory and
> the linking is correct.
> I even tried moving the .js files into the same directory as the web
> page and linking it by calling "scriptaculous.js".
>
> Am I installing this wrong?
> Is there more I need to do?
> Do the Javascripts only work on certain types of servers?

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

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

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



[Proto-Scripty] Re: Works in webkit browsers but fails in IE and Firefox

2010-09-13 Thread ColinFine


On Sep 10, 8:43 pm, SpaceTripStudios 
wrote:
> Hey there, I'm a noob to web development and even more so with
> JavaScript but my big goal is to be a web standards aficionado. So
> imagine how thrilled I was to craft my first site and have it work
> perfectly in Chrome, Safari and... that's it. Explorer and Firefox
> don't like the simple slide-out contact form I created.

It would be helpful if you would be more specific about "don't like".
Do they
- report an error on loading?
- load but do nothing?
- do something but give the wrong result?
- hang?
- crash?
- something else?

It is not a coincidence that bug-reporting sites often have boxes
labelled "expected behaviour" and "results seen" or words to that
effect.

-- 
You received this message because 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: Nested Ajax.Updater

2010-09-13 Thread ColinFine


On Sep 10, 7:29 pm, Ed  wrote:
> I have the Facebook Social Plugin (Like Box) in a site that I am
> building.
>
> A good portion of the visitors are behind corporate firewalls, and if
> their browsers detect a Facebook domain they will reject the call to
> the plugin.
>
> I am using the Ajax prototype to make the calls to Facebook from my
> server which has no firewall that would prevent the Facebook call.
> However, when you call the Facebook plugins (irrespective of FBML/JS
> or iFrame version) it returns a bunch of new Javascripts and IFrames
> that make additional Facebook domain calls defeating the purpose.
>
> I built a version which nests two Ajax Calls with the hope that the I
> can force all the response to be executed on the Server, and just
> return the final rendered plugin to the browser. However, the first
> Ajax.Updater call simply returns what is in the HTML file not allowing
> it to execute. I don't know if Ajax.updater has the smarts to allow
> this to work, but I do have the evalscripts option set to true.
>
> What I have in mind is the following process:
> 1) Call the Ajax.Updater from the Index.html to a file named
> Loader.HTML

I don't understand "to a file named" - do you mean that loader.html is
what is fetched by the Ajax call?

> 2) When the body onloads it will call another Ajax.Updater that makes
> a call to Facebook.HTML, which has the FBML to call the Facebook
> Plugin call.

When what body (on)loads, where? Ajax.Updater (and any other Ajax
operation, usually) does not load a page, so no 'onload' event is
triggered.

> 3) The response from Facebook.HTML will load into Loader.HTML, which
> will execute all the iFrames and Javascript that is returning from
> Facebook

Where is this Loader.html running?

-- 
You received this message because 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: Observer mouseleave does not work how I expect

2010-09-15 Thread ColinFine


On Sep 14, 6:21 am, ncubica  wrote:
> Hi... I have a list  with 3 observers click,
> mouseover, mouseleave, the problem is when I tried to observer the
> mouseleave event throw the  object doing something like
>
>         $(this.id).observe("mouseleave", function(event){
>            var li = event.findElement("li");
>             if (li) {
>                //do some
>             }
>         }.bind(this));
>
> is weird sometimes work and in Internet explorer doesn't work but
> insted If I do something like
>
>         this.tabs.each(function(item, index){
>             var idObject = ""// some id format;
>             $(idObject).observe("mouseleave", function(event){
>                 //do some
>             }.bind(this));
>         }.bind(this));
>
> works perflectly does anyone knows why is the reason for this
> behavior??
>
This is puzzling, as AFAIK "mouseleave" is implemented _only_ on IE.
[1]

Are you sure you don't mean "mouseout", which is implemented on all
browsers, but bubbles, which means that if you set it on the ul it
will fire whenever you leave the ul _or one of its li's_?

[1] http://www.quirksmode.org/dom/events/mouseover.html

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



[Proto-Scripty] Re: Nested Ajax.Updater

2010-09-16 Thread ColinFine


On Sep 15, 1:54 am, Ed Fullman  wrote:
> The file fbsidebar.html is a standard Facebook plugin as follows.
> I need fbsidebar.html to run on the server, and return only the rendered
> code. In this (current) configuration, the Ajax.updater in Index.html will
> return a bunch of iframes and javascript that make subsequent calls in the
> browser to Facebook domains encountering corporate firewalls.

AFAICS fbsidebar.html is HTML with Javascript embedded.

I don't think you can run Javascript on the server without a SSJS
system on the server: I've never heard of running it server-side in an
HTML page like a PHP program.

-- 
You received this message because 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: what am i missing .. observing a radio button

2010-09-28 Thread ColinFine


On Sep 27, 7:08 pm, Jimmy Brake  wrote:
> Each button has a unique ID, I could name them all the same thing but ..
> each button has different affect on the page I was hoping to just catch the
> the unselect event ...
>
Each button _must_ have a unique ID, but that's not the point.

You don't say which event you are monitoring but neither 'click' nor
'change' will be fired when _another_ button is clicked ([1]). AFAIK
there is no 'unselect' event (or indeed a 'select' event except for
text fields)

You need to observe all the buttons for click (or observe their common
container, and use findElement to see if one of the buttons has been
clicked) and call actions appropriate to unselecting the other buttons
yourself.

[1]: http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3

-- 
You received this message because 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: what am i missing .. observing a radio button

2010-10-07 Thread ColinFine


On Oct 6, 2:17 pm, Jimmy Brake  wrote:
> :-( bummer about the no unselect ..

Yes, it's one of the many ways in which HTML forms just aren't up to
the needs of the 21st century. Don't know whether it's better in
HTML5.

Colin

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



[Proto-Scripty] Re: Guidance Needed: Math manipulatives project

2010-11-19 Thread ColinFine


On Nov 17, 4:44 pm, Phil Petree  wrote:

>  The best starting point to learn
> more is from this post by wiki founder Jimmy 
> Wales:http://en.wikipedia.org/wiki/Human_interface_guidelines
>

Was that a joke? What leads you to think that Jimmy Wales had anything
to do with that article? He appears nowhere in its history.

-- 
You received this message because 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: How to create math manipulatives

2010-11-19 Thread ColinFine


On Nov 18, 4:14 am, clumsy7  wrote:
> Hey guys I am creating an application to help teach kids basic math.
> In my application the screen is divided in to 2 parts the right part
> is to enter number, the left part is a dynamic visual representation
> of whats happening on the right)the kid can enter values in the text
> boxes on the right (initally the values in the 2 textboxes will be 0).
>
> My code is below and need help with it. Please help!
>
If you would care to give an indication of what it is that you need
help with, you are more likely to get that help. Is something not
working? (If so, what, and how?) Is there something you'd like to add
to it but don't know how to make it work? What?

-- 
You received this message because 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: How to create math manipulatives

2010-11-22 Thread ColinFine
"ain't working" means nothing.

What happens?
What do you expect to happen?

Also...

I've never heard of onforminput (I'm not familiar with HTML5) but I
think it's premature to be using HTML5 facilities unless you know
which browsers your users will be using. In any case, it is at least
being discussed to remove it. (http://lists.w3.org/Archives/Public/
public-webapps/2010OctDec/0183.html)

I don't know why you are posting this on a prototype-scriptaculous
list, since you appear to use neither in your script.

Colin

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



[Proto-Scripty] Re: Behavioral of select option

2010-12-23 Thread ColinFine


On Dec 22, 9:57 pm, kstubs  wrote:
> I have a select option, in HTML It is empty like this:
>
> 
>
> After page load I make ajax request and finish loading the selector with
> additional option(s).
>
> So I might have:
> 
>   1
>   2
>   3
> 
>
> I have registered an event to handle a submit click for the form and pass
> the value to the click handler event like this:
>
> $('paging').down('input.previous').observe('click',
> _msoS.handlePagingSubmit.bindAsEventListener(_msoS, $F('myselect')));
>
> The value passed to my click handler for myselect is NULL but indeed the
> first option is selected.
>
You haven't said how the first option is selected (whether by the
user, or by the initial Ajax load); but I think the problem might be
that with some browsers if you populate a  by Javascript it is
not enough to have one or more of the s 'selected': you need
to tell the  explicitly what is selected.

-- 
You received this message because 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: How to show the full resolution image at clicking on thumnail

2011-01-10 Thread ColinFine
Pardon me if I'm misreading, but your code appears to use jQuery, not
Prototype.

This is a group for Prototype and Scriptaculous.

-- 
You received this message because 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: number sign (#) in a select option - gets truncated

2011-01-14 Thread ColinFine


On Jan 13, 6:52 pm, ehickstech  wrote:
> I have a select field in a form and one of the options has a number
> sign, such as "100# Glossy Cover"
>
> I'm using Prototype to process an AJAX request and it's lopping off
> the number sign and everything after it.
>
> Any ideas what to do about this?  Thanks.

You haven't told us how you are sending the data, but if it's going in
a GET, you almost certainly need to uri_encode the data somewhere.

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



[Proto-Scripty] Re: number sign (#) in a select option - gets truncated

2011-01-17 Thread ColinFine


On Jan 14, 2:53 pm, ehickstech  wrote:
> Thanks for responding.  I'm sending via POST.  Here's the script
>
> function sendRequest() {
>         new Ajax.Request("/edit/doorhangers/add_ajax/",
>         {
>             encoding: 'UTF-8',
>             method: 'post',
>             parameters: 'qty='+ $F('qty') + '&size='+ $F('size') +
> '&stock='+ $F('stock')
>                 + '&sides='+ $F('sides') + '&price='+ $F('price'),
>             onComplete: showResponse
>         });
>     }
>
> The stock field has values in it like "100# Glossy Cover".   When I
> echo it from the AJAX function, it just says "100"

You might be sending by POST, but you are creating a query string as
used in a GET, so you would need to uri_encode.
If you are using POST, you don't need build a string like that anyway.
As others have suggested, giving Ajax.Request an object is a better
solution.

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



[Proto-Scripty] Re: Passing JS var to ajax.updater parameters

2011-01-31 Thread ColinFine


On Jan 28, 2:29 am, Bilal Inamdar  wrote:
> I am facing a very stupid issue but stuck there many hours
>
First, you have written 'encryptSTR' in one place and 'encrytSTR' in
another: is that just in transcribing the code, or is it really there?

Next, are you sure that the Ajax is returning what you expect? You
haven't said anything about the 'url' and 'tokenkcool' parameters: are
they right for your PHP program?

I would look at this under a debugger (such as Firebug) to view the
result returned from the Ajax; and if that looks right, put a
breakpoint on alertME.

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



[Proto-Scripty] Re: Two Dimensional Arrays in class

2011-01-31 Thread ColinFine


On Jan 30, 3:14 pm, houpdelta  wrote:
> Hi,
>
> I would like to declare a two dimensional array in a class, but I
> can't do this.

You cannot assign to an array (the second dimension) which doesn't yet
exist.

You need:

erreur: [];

...

Execute.erreur[1] = [];
Execute.erreur[1][1] = "[obj1, obj2]";

If they started from 0, you could condense these by creating an array
literal on the right hand side:
Execute.erreur[0] = ["[obj1, obj2]"];
but I'm not sure there's an easy way of doing this starting at 1.

(The value you are assigning is the literal string "[obj1, obj2]"
which contains the square brackets and has nothing to do with the
parameters obj1 and obj2: I suspect that is not what you intended).

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



[Proto-Scripty] Re: Two Dimensional Arrays in class

2011-02-01 Thread ColinFine

> It's curiously that not declare two dimensional array in prototype.

It's nothing to do with Prototype. Javascript (like many scripting
languages) doesn't have two-dimensional arrays.
You can simulate them with arrays of arrays, but an initialiser has to
be specific: if you are going to  want a [1] row, you need to create
that sub-array either in the initialiser or subsequently.

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



[Proto-Scripty] Re: part update of webpage

2011-02-02 Thread ColinFine


On Feb 1, 4:26 pm, kenny70  wrote:
> Hi
> tried the following to update a dynamic table on a web page every 120
> seconds (latest soccer scores)
>
> new PeriodicalExecuter(function(pe) {     new Ajax.Updater('score',
> 'latestscore.php', {       parameters: { somename:
> 'somevalue' }     }); }, 120);
>
Try running your Ajax program on its own in the browser:

http://(whatever your path is)/latestscore.php?somename=somevalue

and see what it sends.

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



[Proto-Scripty] Re: Help with xml attributes in json object

2011-03-31 Thread ColinFine
In Javascript, you can always use the array-name[expression] form,
such as json.points['@attributes'];

The array-name.id form is precisely equivalent to array-name["id"]
*provided id is a valid javascript identifier*. Otherwise the latter
is invalid.

Colin

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


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.

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



[Proto-Scripty] Re: $$() and Element.observe() question

2008-10-29 Thread ColinFine



On Oct 29, 4:58 am, Robert Zotter <[EMAIL PROTECTED]> wrote:
> kimbaudi,
>
> Like you said, $$() returns and array of DOM elements. You just need
> to iterate over the collection and set up the observe event on each
> item. For example:
>
> $$('.class').each(function(element) {
>   element.observe('click', function() {
>     alert('clicked');
>   });
>
> });
>

Or slightly more compactly

$$('class').invoke('observe', 'click', function() {alert('clicked')});

This would be a good time to use a named function rather than an
anonymous one, unless you actually need a separate instantiation of
the function for each element.

Colin

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



[Proto-Scripty] Re: Autocompleting text fields (customized)

2008-10-30 Thread ColinFine

[I hate top-posting, but that seems to the the norm here]

Use 'informal' [1]

Make your ajax call return
Ada Noel[EMAIL PROTECTED]
etc.

Then have a CSS rule
span.hide {display:none}

The CSS will ensure that only the name is displayed to the user, but
the Ajax.Autocomplete takes only the text which is NOT in a span with
class 'informal', and so will take only the email address.

Colin


[1]: http://github.com/madrobby/scriptaculous/wikis/ajax-autocompleter,
section 'Server return'


On Oct 30, 6:41 am, srid <[EMAIL PROTECTED]> wrote:
> Hello
>
> In the To field when you type the letter 'a', the first item in the
> drop down list is the Ada Noel, how do I capture the e-mail address,
> basically I want to set a hidden field in the form with the email
> address selected.
>
> thanks in advance
> Sridhar

--~--~-~--~~~---~--~~
You received 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Element.update()

2008-10-31 Thread ColinFine

@Gabriel: unquoted keywords can be a problem in IE for certain
reserved words (eg 'class'), but in general it's fine to leave them
unquoted, and I've never seen a problem from this in firefox. So I
don't think your advice is likely to be helpful in this case.

@cyiam: Be aware that 'innerHTML' is not part of the W3C standard. IE
introduced it, and Firefox then implemented it, but there is no
guarantee that Firefox will always give the same result.

You could look at it in Firebug and try to see what's happening, but
why not use Prototype's 'update' instead:

var newOption = new Element('option',
{value:item.id}).update(item.nm);


Colin


On Oct 31, 12:35 am, "Gabriel Gilini" <[EMAIL PROTECTED]> wrote:
> Well, first of all, try quoting your hash keys like this:
> list.each(function(item){
>                        var newOption = new Element('option',
> {'innerHTML':item.nm,'value':item.id});
>                        selectList.insert({bottom:newOption});
>                });
>
> If it still doesn't work, try using firebug's[1] console and debug to see
> any exception the script might be throwing.
>
> [1]www.getfirebug.com
>
> Gabriel Gilini
>
> www.usosim.com.br
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
> On Thu, Oct 30, 2008 at 5:30 PM, cyiam <[EMAIL PROTECTED]> wrote:
>
> > HELP! This is the first time I have my script working for IE but not
> > for Firefox.
> > I have a 3 drop downs. The first dropdown dictates what will be shown
> > on the second. And second drop down dictates the third. I use
> > Ajax.Request() to get the drop down values from database. onSuccess, I
> > call the function below:
>
> > function updateList2(list){
> >        var selectList = $('list2');
> >        selectList.update();
>
> >        var newOption = new Element('option',{innerHTML:'-- Select One
> > --',value:''});
> >        selectList.insert({bottom:newOption});
> >        if (list){
> >                list.each(function(item){
> >                        var newOption = new Element('option',
> > {innerHTML:item.nm,value:item.id});
> >                        selectList.insert({bottom:newOption});
> >                });
> >        }
> > }
>
> > Works fine in IE, but when Firefox will not insert the new options
> > into the list!
>
> > 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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Simple, unobtrusive way to open all links marked external

2008-10-31 Thread ColinFine

I'm not certain of this, but I think that using 'invoke' will get you
the wrong binding: invoke
calls the invoked function as a *method* on each element, ie. the
element will be passed to openNewWindow as 'this', not as an argument.

I think you just want
 filteredResult.each(openNewWindow);

(note that you pass the function, not its quoted name)

Colin

On Oct 30, 6:07 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi guys,
>
> I'm learning the prototype library after coming from jQuery, and I'm
> trying to write a simple snippet that opens external links in a new
> window.
>
> This doesn't seem to work in Firefox, or Safari, and I'm not sure what
> I'm doing wrong here,
>
> I'm sure it's something really obvious, but I've been staring at this
> code for so long now that I've effecitvely gone snow blind.
>
> Can anyone help?
>
> I'm using prototype 1.6.0.1, and I'm on a mac.
>
> // goal - select all external links and onclick, open that link in a
> new window, in an unobtrusive manner
>
> var openNewWindow = function(element) {
>         element.observe('click', function() {window.open(element.href);} );
>
> };
>
> // begin constructing regexp that makes any url with the host domain
> in it, and with the optional www prefix
> var internalUrl = "/" + "(www)?" + document.location.hostname + "/";
>
> // turn string into regexp to match against
> var pattern = eval(internalUrl);
>
> // reject all links whose href matches the host domain regexp defined
> above
> filteredResult = result.reject(function(e) {
>             return e.href.match(pattern);
>             });
>
> add onclick handler each member of the array of remaining links
> filteredResult.invoke('openNewWindow');
--~--~-~--~~~---~--~~
You received 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Autocompleting text fields (customized)

2008-10-31 Thread ColinFine

Oh, right. In that case you can put the email address in , so it will appear in the list but not the input
field.
Then you'll need to provide an afterUpdateElement callback to extract
it from the  and put it in your hidden field.


Colin


On Oct 31, 12:57 am, Sridhar <[EMAIL PROTECTED]> wrote:
> Hi Colin,
> Really appreciate your input.
>
> Sorry, I should've been more crisper with my requirement. Let me try to do
> that:
>
> When the user types in 'a', I still like the display of the drop down list
> with contact name and email address one below the other. When I select a
> contact from the list, I still need the contact name Ada Noel to be
> displayed in the text field to the user. At the same time, I also need the
> email address [EMAIL PROTECTED] to be set in a hidden text field inside
> the same form.
>
> Hope I got it clear this time around.
>
> Thanks
> Sridhar
>
> On Thu, Oct 30, 2008 at 4:52 AM, ColinFine <[EMAIL PROTECTED]> wrote:
>
> > [I hate top-posting, but that seems to the the norm here]
>
> > Use 'informal' [1]
>
> > Make your ajax call return
> > Ada Noel > class='hide'>[EMAIL PROTECTED]
> > etc.
>
> > Then have a CSS rule
> > span.hide {display:none}
>
> > The CSS will ensure that only the name is displayed to the user, but
> > the Ajax.Autocomplete takes only the text which is NOT in a span with
> > class 'informal', and so will take only the email address.
>
> > Colin
>
> > [1]:http://github.com/madrobby/scriptaculous/wikis/ajax-autocompleter,
> > section 'Server return'
>
> > On Oct 30, 6:41 am, srid <[EMAIL PROTECTED]> wrote:
> > > Hello
>
> > > In the To field when you type the letter 'a', the first item in the
> > > drop down list is the Ada Noel, how do I capture the e-mail address,
> > > basically I want to set a hidden field in the form with the email
> > > address selected.
>
> > > thanks in advance
> > > Sridhar
--~--~-~--~~~---~--~~
You received 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: testing whether all elements in a div have a certain class

2008-11-03 Thread ColinFine

There is something very confusing about what you have said. In your
text you say "I can only pass the ID of the element through a
function", in the code you refer to "span_1" etc as the 'spanName',
but then it is actually a class name. Is it really an ID, a name, or a
class?
You only exhibit a single span with each class name 'span_1' etc. so
I'm guessing that you have several spans with class 'span_1', several
with 'span_2' etc. Is that the case?

If so, what I think you want is

if $$('span'+level_ID).all(function(span) {return
span.hasClassName('complete');}) { ...

On the other hand, if you have only one 'span_1', only one 'span_2',
then I don't understand why you are using these separate classnames,
as they are effectively duplicating the id's. In this case, I would
recommend you give them all a single class (say 'myspan'), and then
write

if $$('myspan').all(function(span) {return
span.hasClassName('complete');}) { ...

Colin

On Nov 3, 9:51 am, Matt <[EMAIL PROTECTED]> wrote:
> On Nov 1, 4:38 pm, Jarkko Laine <[EMAIL PROTECTED]> wrote:
>
>
>
> > 1) your alerting with a string "bar" there.
> > 2) $$ returns an array of elements. If you want a single item, why not  
> > give the span a unique id and call it with $? If you need to use the  
> > double-dollar selector, you need to get the first element of the array  
> > to get the actual element: $$('#container_'+boxID+' span')[0]; One  
> > option that gives you the span element (with the html syntax you  
> > posted before) is this: $('container_' + boxID).down('span').
>
> > > click here
>
> > > // returns "$$('#container_24 span')";
>
> > You mean the function above alerts that string? Frankly, I don't  
> > believe you :-)
>
> > The parameter that $ and $$ take is just a normal string. There's  
> > nothing magical about it. So if you can do "string" + someVar, and the  
> > result is a string, you can give it as a parameter to those functions.
>
> > //jarkko
>
> I tried out those methods (the [0] ending and the .down function),
> neither worked. I'm still struggling to get my head around this - I
> can only pass the ID of the element through a function, so it's always
> going to be a variable, I can't know it in advance. Here's some actual
> code (the above stuff was a simplified (and badly-written...)
> function, not the actual one):
>
> //contained within my function:
>
>         var spanName = "span_"+levelID; //levelID is passed in the function
>         var spanArray = document.getElementsByClassName(name); // gets all
> the elements I want to test
>         var completeArray = spanArray.getElementsByClassName('complete'); //
> should get all elements within the above array with a class of
> 'complete'
>
>         // if the number of spans is the same as the number of spans with
> 'complete' class:
>         if(spanArray.size() == completeArray.size()) {
>                 $('level2_click_1').removeClassName('incomplete');
>                 $('level2_click_1').addClassName('complete');
>                 $('level2_click_1').update("ON");
>         } else {
>                 $('level2_click_1').removeClassName('complete');
>                 $('level2_click_1').addClassName('incomplete');
>                 $('level2_click_1').update("OFF");
>         }
>
> HTML:
>
> 
>   OFF
> 
>
> 
>   OFF
> 
>
> 
>   OFF
> 
>
> 
>
> Basically, when all three of those spans have class name
> 'complete' (eg, are turned on) I want a different span somewhere else
> (the 'level2_click_1' span, which I will need to turn into a variable
> rather than a hardcoded reference) needs to switch to 'complete' too.
>
> Does this make any more sense now?
>
> Matt
--~--~-~--~~~---~--~~
You received 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Scriptaclous Problem

2008-11-12 Thread ColinFine



On Nov 11, 4:45 pm, alohaaaron <[EMAIL PROTECTED]> wrote:

...

> I also can't get the results to show by just the first letter.  Say if
> the list contains coffee and frank, I type f and just want frank to be
> found, not coffee.  But it shows both frank and coffee.  Here is the
> link
>
> here is the php lookup
>
>         $sql = "SELECT UNIQUE_CUST_ID FROM test2 WHERE UNIQUE_CUST_ID LIKE
> '%" . $_POST['search'] . "%'";
>         $rs = mysql_query($sql);
> ?>

That's because you're telling it in the SQL to match any string
containing (not just starting with) the search string.

Change
 '%" . $_POST['search'] . "%'";
to
 '" . $_POST['search'] . "%'";

Colin

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



[Proto-Scripty] Re: Ajax not working with IE

2008-11-17 Thread ColinFine

IE is picky about commas at the end of object literals. Try removing
the comma at the end of this line:

parameters: {query: this.value},

Colin


On Nov 17, 1:27 am, bejitto101 <[EMAIL PROTECTED]> wrote:
> My ajax works with FF but fails with IE. The code is quite simple:
>
> Code:
>
> document.observe("dom:loaded", load);
>
> function load() {
>         //$$(".tab-controls").invoke('observe', 'click', showControls)
>         $("venue-search").observe('keyup', venue_search);
>
> }
>
> function venue_search()
> {
>         if(this.value.length>2){
>                 new Ajax.Updater('search-results', 'includes/
> getHappeningsSearch.php',
>                 {
>                         parameters: {query: this.value},
>                 });
>         }
>
> }
>
> Basically it takes an input, and if the length is >2 it performs a
> search for venues matching the input. You can see it in action 
> here:http://bellevue.com/happenings-entry.phpIt's under Event Location,
> and type in something like "grill".
>
> Much 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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: problem with draggable

2008-12-01 Thread ColinFine



On Dec 1, 7:26 am, Harry Porto Schroeter <[EMAIL PROTECTED]>
wrote:
> hi
> it's possible to make an element that was inserted on the page by
> ajax.update draggable ?

Yes. Either
- pass 'onComplete' the name of (or a call to) a function in your
original page which will do this, or
- include code in the update to do it, and make sure you set
'evalScripts' to true.

Colin

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



[Proto-Scripty] Re: autocomplete variant

2008-12-08 Thread ColinFine



On Dec 8, 3:05 am, macsig <[EMAIL PROTECTED]> wrote:
> Hello guys,
> I'm trying to implement a variant of the classic autocomplete but I
> can't make it works.
> Basically what I want is to show for each element that matches with
> the written text the element name and a checkbox (having the element
> id as a value).
> For instance, if my table contains:
>
> ID  | NAME
> 1   | Tom
> 2   | Timmy
> 3   | John
> 4   | Nick
> 5   | Theodora
>
> When I digit 'T' on my textfield the div called "friends" should be
> populated with
>
> [] Tom
> [] Timmy
> [] Theodora
>
> Can someone help me out with this? Any help is welcome.
>
> thanks and have a nice day!
>
There are several separate parts of this:
- generating the entries to include the checkboxes
- acting on the result.

The Ajax.Autocompleter in scriptaculous requires you to return an
unordered list for the 'drop-down', and there's nothing to stop you
putting  elements inside the 's. If you still want to use
the "pick an entry from the list and it will be as if that had been
typed in the text input box", you can do that - make sure the 
elements are inside , and the Autocompleter
code will ignore them in generating the value to return.

However, I'm guessing that that is not what you want, but rather for
the user to proceed by ticking some of the boxes. In that case, I
don't think Ajax.Autocompleter is going to be much use to you, and you
might just as well use Ajax.Updater and do the rest yourself. You can
possibly copy some code from Ajax.Autocompleter.

The code you want (in very sketchy form) is something like

observe($('textbox'), 'keypress', function() {
  Ajax.Updater('listdiv', ...
 {parameters: { partname: $F('textbox'), ...

});

And then your Ajax backend would match the 'partname', and deliver a
list of

Tom

or maybe just lines with  between

You'll need more than this - probably want to put a delay on before
sending, so as not to send until the user has stopped typing for a
bit, and to handle ESC and things. You can copy some of these out of
Ajax.Autocomplete.

Colin

> Sig
--~--~-~--~~~---~--~~
You received 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: which is the right ajax result container in a html table?

2008-12-08 Thread ColinFine



On Dec 5, 2:50 pm, Scrooge <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a simple problem for somebody who already dealed with it, but
> still after trying for several days, no solution yet:
>
> I want to use Ajax.Updater to dynamically update single rows of a
> table. Furthermore I want to use Ajax.Updater to add new rows to the
> table. What I currently do is using a  statement as an
> ajax result container for each row. I am not sure if this is a clean
> solution but it works. Altough I have a lot of tbody tags per table it
> seems the only possible container to which I can direct an ajax result
> like "..."
>
> I can use the same container () to add new rows
> to a table. But as soon as I want to change these newly added rows, I
> have the problem that there may be several new rows in this one
> container and I can not change a single row. I tried to let the ajax
> result for new rows add another  tag (which would be
> inside the first  tag) and that does not work. You can
> not open several tbody tags at once.
>
> As there are many Ajax applications that use rows, there must be a
> solution to this. I am just not sure if there is a way to use
> ajax.updater for this. Please help.
>
The HTML specification says that a table has one or more tbody
elements, each of which contains one or more tr elements. You can't
nest a tbody in a tbody, or a tr in a tr.

So, if you need to add a row, you can either add it to an existing
tbody, or add a new tbody (containing it) to the table.
But if you need to replace one row in a tbody,
*either* you can work on the tbody, in which case you will have to
remove the existing tr and insert the new one yourself,
*or* you operate on the tr, and update its contents (with a list of th/
td elements, not with a tr).

What I would do is to make sure that each row (including each added
row) has a unique id, and then use Ajax.Updater(, ... )
and make sure the updating code in this case is a list of cells, not a
tr.

Colin fine

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



[Proto-Scripty] Re: autocomplete variant

2008-12-09 Thread ColinFine



On Dec 8, 9:30 pm, macsig <[EMAIL PROTECTED]> wrote:
> Hello,
> I have an issue with Ajax.updater.
> Since I'm a prototype newbie I guess it is something easily solvable.
>
> Basically I don't understand what I have to put as url.
> In any example I can find on prototype website they show '/some_url'
> without specifying its meaning.
>
The url is entirely up to you. It is the URL of the script that you
write to be the Ajax backend: you can call it what you like, and put
it where you like (though it introduces many problems if it isn't on
the same domain as the script it's being called from).

> Since my app is a Rails one I tried to create a partial (list_item)
> with the list item and I passed it as a url but I get "Couldn't find
> Person with ID=list_item
> If I remove the url parameter I get "
> ActionController::MethodNotAllowed   Only get, put e delete requests
> are allowed." even if I specify get as a method.

I don't know Rails, but if it's anything like symfony, a partial isn't
enough: it needs to be its own page, which will parse the arguments
from the query string, generate the output, and send it with the
proper headers. It could be bare text, XML, HTML or it could be empty
and return the data in an X-JSON heaader. But if you're going to use
Ajax.Updater, you need to return an HTML fragment (not a whole HTML
page). In any case, though, it needs to have suitable HTTP headers.
I'm guessing that Rails has a way of creating a page which only
returns the headers and text you want.

Colin

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



[Proto-Scripty] Re: I want to use autocompleter in an array of input text fields (name[])

2008-12-11 Thread ColinFine



On Dec 9, 11:31 pm, tumba <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to have a multiple input text fields with a name "name[]"
> so that I will be able to process them as an array with PHP and Insert
> them in Mysql.
>
> But as soon as I use the bracket, the autocompleter stops working. Is
> there any way to go around it?
>
> document.observe('dom:loaded', function() {
> new Ajax.Autocompleter('name[]', 'name_suggestions','auto.php',{tokens:
> [',']});});

The first argument to Ajax.Autocompleter must be the object ID, not
its name: HTML id's must be unique in the document, and may not
contain '[' or ']'. The 'name' attribute (which is significant for a
form element) may be any character data, and is where some systems
treat '[]' specially.

I'm not certain but I think if you define your input element as

and then
new Ajax.Autocomplete('name', ... )
it will work.

> Also, I want to make sure that the value that the user types into the
> text field exists in my Mysql database. So the user can only write a
> value that matches a value in the database. So when a value that
> matches a value in the database is written, how can I catch that?
> Should this happen in my auto.php file?

Yes. The whole point of using an autocompleter is that your back-end
code should do the DB access and return only the values *in the
database* which match what the user has so far typed.

Colin

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



[Proto-Scripty] Re: Is this a bug? an element is enclosed unexpectedly by an inserted method.

2009-01-14 Thread ColinFine



On Jan 13, 4:04 am, Hamamoto Noriaki  wrote:
> Hey Kangax,
>
> Thank you for the reply.
> Do you think the reason of the problem I met is because of using 
> instead of  ?
> is Using  prohibitted? Do you know why it happns?
>

"" is not valid in either HTML or XHTML.

See http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-4.3

Only 'empty elements' - those that MAY NOT have any content, like 
- can use the shorthand form.

Colin

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



[Proto-Scripty] Re: Bug with afterFinish: when used during a mouse event?

2009-01-16 Thread ColinFine



On Jan 13, 12:12 pm, Marcos  wrote:
> Hello, considering that when I use the afterFinish call on the
> scriptaculous effects that are used on initial page load it works fine
> and the function is called indeed after the effect has finished
> rendering it's final loop.
>
> When i use the same afterFinish attribute on an effect that is called
> after a mouseover event, the function is called immediately (on the
> first frame). Is this a known bug? or am I missing something?
>
> mouseover: function(e) {
>         var element = e.element();
>         if (this.ready && (element.rel=='in' || element.rel==undefined))
>         {
>                 new Effect.Highlight(element, { startcolor: '#11', 
> endcolor:
> '#BB', restorecolor: '#BB', duration: 0.5,queue: { position:
> 'end', scope: element.id + '_hl', limit: 2}});
>                 new Effect.Move(element,{ x: -30, y: 0, mode: 'relative',
> transition: Effect.Transitions.spring, duration: 0.6, queue:
> { position: 'end', scope: element.id + '_mv', limit: 2}, afterFinish:
> this.mouseover_finished(element)});
>         }
>
> },
You are calling this.mouseover_finished(element) and passing the
result as the value of 'afterFinish'.

You need to pass a function, not a function call. Either an anonymous

function(element) {this.mouseover_finished(element)}

or I suspect this will work

afterFinish: mouseover_finished.bind(this)

though I haven't followed through the meanings of the various 'this'
tokens to be sure.

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



[Proto-Scripty] Re: reserved words for prototype and/or scriptaculous?

2009-01-16 Thread ColinFine



On Jan 15, 7:52 pm, geoffcox  wrote:
> Nathan,
>
> I am not getting this yet!
>
> Say I have following simple form - what is
>
> getData(evt.element().myform);
>
> sending to getData()?
>
When 'send' is clicked, that function is called with the event as its
argument. It finds the element actually picked (even if that was a
separate element inside 'send' - but in this case there's no other
element, so it must be the button) and gets its 'myform' attribute,
which as far as I can see doesn't exist.

I'm guessing that you mean to return the form for some reason. If it
is that one form only, you can hard code it as

getData($('myform1'))

but if you want it to be more general, you can say

getData(evt.element().up('form'))

but I may have misunderstood your intent.

Colin

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



[Proto-Scripty] Re: reserved words for prototype and/or scriptaculous?

2009-01-19 Thread ColinFine

>
> All form controls have a form property that is a reference to the form
> they are in, so why not:
>
>   getData(evt.element().form))
>
True! I've got so used to working in Prototype, I sometimes forget
about good ol' Dom.

Colin

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



[Proto-Scripty] Re: prototype differed answer to request

2009-01-19 Thread ColinFine



On Jan 16, 9:12 pm, cb  wrote:
> Thanks for your informative reply.
> In my case I think I should have only at most two concurrent request
> at any time. But what I really need is to be able to abort a pending
> notify request. If I can, then I will have at mot one request at a
> time.
> Basically I will have a pending notify request until the server
> replies to it. But if I need to change a state from the client, I need
> to abort the notify request, change the state and then send a new
> notify request.
> Is it possible to abort a pending request from thr prototype
> framework ?
>
Again, not in Prototype. But XMLHttpRequest has an abort method.
IIRC Ajax.Request doesn't have a documented way of getting at the
XMLHttpRequest object (except in its callbacks, where it is passed as
an argument). But you can get it from its .transport property I
believe.

Colin

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



[Proto-Scripty] Re: checkbox insertion/removal problems

2009-01-19 Thread ColinFine



On Jan 18, 7:43 pm, jmack159  wrote:
> hello there,
>
> i have a form for a user to add an article to the CMS system. one
> section of the form, the user has the ability to "attach" publications
> that are already in the system to the article. one div
> ("#attachSelect") contains articles the user can add. when a user
> click on a label, i make a copy of the containing div switch the class

I don't think you are. You are merely assigning the same div to a
different variable, so
element and copy both point to the same object. If you want to make a
copy, you
need to use Object.clone. (But I haven't followed through the logic to
see whether this actually matters to you or not).

> names, then insert the dive into a div containing the added
> publications ("#currAttachments). i then remove the div using
> element.parentNode.remove(). if the user click on one of the added
> publications, the reverse should happen and the div is removed from
> the added div and inserted into the div of publications to be added.
> the checkboxe's value should never be touched so that when inside
> div#attachSelect the checkbox is not selected, and with within
> div#currAttachments the checkbox is selected. everything works fine in
> FF 2/3, netscape, google chrome, but breaks in IE 7. in IE 7 the
> publications are added ok, but are unable to be removed. (checkbox can
> be toggled, but its parent div is not removed). i get no errors with
> firebug in FF or through IE
>
> i originally tried to do this with the checkbox event "onchange", and
> i got the same result, except for the added IE bug of the delayed
> onchange (delayed until the element looses focus).
>
It's not a bug, it's correct behaviour according to the standard: [1]

"onchange = script [CT]
The onchange event occurs when a control loses the input focus and
its value has been modified since gaining focus. This attribute
applies to the following elements: INPUT, SELECT, and TEXTAREA."

Use 'onclick' instead.

One other point - I'm not at all sure that   writeAttribute
('onclick', ...) works, and on which browsers. MUCH better to use

  $(copy2).observe('click', addPub);

(Note that you have to pass a function, not a string or a function
call).

I don't know if any of these points will help your problem or not.

Colin Fine

[1] http://www.w3.org/TR/html401/interact/scripts.html#events

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



[Proto-Scripty] Re: Scriptaculous problem with option field

2009-01-21 Thread ColinFine



On Jan 20, 4:33 pm, rolfK  wrote:
> Hello,
>
> Thank you for your fast response. But unfortunately your suggestion
> does not solve the problem. Using xyz as query, the following string
> is transferred:
>
> Without option field:
> query=xyz
> That is okay and as expected. With your suggestion as option field,
> the following is pushed to the server.
> query=xyz&%5Bobject%20Object%5D
>
There is what looks very much like a bug in the scriptaculous
documentation (as is actually noted at
http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter): the
'parameters' property needs a string, not an object.

Try

new Ajax.Autocompleter(
  "query", "auto_suggest",
  "include/suggest.php",
  { parameters: "media_only=media_only"  }
);

It would be very much neater if it did accept an object (and I fell
over this myself).

Colin

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



  1   2   3   >