[Proto-Scripty] Re: Multi-dimensional JSON passed in an Ajax request?

2009-12-18 Thread Ian R

Ahhh.  Thank you so much, sir!  This solution works perfectly for my
needs.  And yes, it does make sense, I just didn't realize.

This is just so totally awesome... god this is the best day EVER!

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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: Multi-dimensional JSON passed in an Ajax request?

2009-12-18 Thread Ian R

Oh, by sir I mean T.J. Crowder (I hadn't yet seen the second
reply).  I don't mean to crud up the list-serv, and thank you Matt
Foster, but I much prefer the first solution... just wanted to
clarify :)

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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] Multi-dimensional JSON passed in an Ajax request?

2009-12-17 Thread Ian R

So ok, I have this JSON string I'm trying to pass as a post.  From my
object's toJSON() method, I get this string:

{
anonymous_element_1: {
class: required,
msg: 
},
anonymous_element_2: {
class: required,
msg: 
},
public_phone: {
class: phone,
value: 706-201-1149,
msg: 
},
private_phone: {
class: phone,
value: 315-487-9176,
msg: 
}
}

Which is valid JSON according to http://www.jsonlint.com/ ...

However, when I try to pass this to a PHP script:

new Ajax.Updater(this.msg, '/inc/Calendar/Validate.php',
{
'parameters':   this.toJSON()
}
);

I get nothing passed.

However, I've noticed that if I take the multidimensional aspect out
of it and just use the format {'key':'value,'key':'value'}, it passes
just fine.  Also, if I specifically set the method to get, I this
passed in $_GET

Array
(
[{anonymous_element_1:_
{class:_required,_msg:_},_anonymous_element_2:_
{class:_required,_msg:_},_public_phone:_
{class:_phone,_value:_706-201-1149,_msg:_},_private_phone:_
{class:_phone,_value:_315-487-9176,_msg:_}}] =
)

Basically a crazy URL-encoded version of my JSON, as the key in a
valueless array.  Hm.

What am I doing wrong here?  I just don't get it.

Thanks in advance!

Ian

--

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




[Proto-Scripty] Ajax.Updater + Sortable.Create = nothing?

2009-11-13 Thread Ian R


Hey all!  I have 4 lists on a page, all if which are filled by an
Ajax.Updater call.  I want them to be Sortable.  I have this code in
my document HEAD:


Event.observe(window, 'load', function() {

new Ajax.Updater('issue_order1', '/inc/modules/issue_order.php?
col=issue_order1', {
  parameters: { onComplete: Sortable.create('issue_order1') }
});

});

... of course I have 4 such calls which run at window load.

But the lists aren't sortable.  I assume this has something to do with
them being updated, because if I disable the Ajax.Updater for a list,
and just make it Sortable, it works fine.  The docs say the onComplete
callback runs at the very end of the Updater call, but replacing my
Sortable.create call with an alert that happens onComplete shows that
the list has yet to be updated and redrawn.

Any ideas?  Any help would be IMMENSELY appreciated.

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



[Proto-Scripty] Re: Making a Draggable-pool

2009-08-11 Thread Ian R

On Aug 10, 2:06 pm, Drr cran...@web.de wrote:
 Hi, is it possible to make a draggable be dragged unlimited times from
 one Position? I want to make some kind of Item pool that can be
 dragged multiple times...



It seems to me -- without fulling knowing what you're planning -- that
you need to be looking into doing this with the Droppable::onDrop
callback.  (Check it out here: 
http://wiki.github.com/madrobby/scriptaculous/droppables)

After releasing your Draggable, you could create a new object using
parameters from it (and the original never needs to change)... That's
probably how I'd do it.

Good luck!
--~--~-~--~~~---~--~~
You received 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] iterator.call is not a function

2009-07-01 Thread Ian R


Ok. So I have a structure like this:

div class=fp_YouTube

div class=player
object width=425 height=349 ... /object
/div

ol class=playlist
li id=YouTubeID_w7naKj-z5So ... /li
li id=YouTubeID_naiN5V4Q1rI ... /li
/ol

/div

And eventually what I am doing is replacing the contents of player
with a new video, based on observing a click on one of the list items
in playlist.  I've done it before but I'm trying to prototypejs it
up a little nicer.

SO... I have this JS code going:

$$('div.fp_YouTube').each(function(el)  {
var player = el.select('.player');
var playlist = el.select('.playlist');
playlist.select('li').each(function(video)  {
console.log(video.id);
});
});

But it 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] iterator.call is not a function

2009-07-01 Thread Ian R


Ok. So I have a structure like this:

div class=fp_YouTube

div class=player
object width=425 height=349 ... /object
/div

ol class=playlist
li id=YouTubeID_w7naKj-z5So ... /li
li id=YouTubeID_naiN5V4Q1rI ... /li
/ol

/div

And eventually what I am doing is replacing the contents of player
with a new video, based on observing a click on one of the list items
in playlist.  I've done it before but I'm trying to prototypejs it
up a little nicer.

SO... I have this JS code going:

$$('div.fp_YouTube').each(function(el)  {
var player = el.select('.player');
var playlist = el.select('.playlist');
playlist.select('li').each(function(video)  {
console.log(video.id);
});
});


But firebug is telling me this:

iterator.call is not a function -- prototype.js (line 661)

I've noticed that if I console.log the original el variable, it
looks like div class=fp_YouTube but if I log the playlist
variable, it comes out as  [ol.playlist] ... is it returning a 1-item
array?  Is there something I am fundamentally misunderstanding,
something I need to do in order to work with playlist the way I've
been working with el?

Thanks in advance, and pardon this message for misfiring and sending
before I was ready.

Ian

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



[Proto-Scripty] Re: iterator.call is not a function

2009-07-01 Thread Ian R


I did check on the array situation -- it's so good and bad that
finally turning to this forum and *writing it all down* usually solves
the problem!

In the above case, $(playlist).select('li').each didn't work, but
playlist[0].select('li').each does.

I'm not sure that I exactly LOVE how that works, but it's not
terrible.  If there's a better way, I'd love to know about it.

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



[Proto-Scripty] Re: Ajax.Updated DIV seems to still have the same innerHTML...

2009-01-09 Thread Ian R


Thanks everybody for your help.  For future reference to other people,
everything I needed to know (so far) is on the How Prototype extends
the DOM page at http://www.prototypejs.org/learn/extensions.

I'd already read it several times but for some reason I kept missing
the point.  This may be related to a lack of sleep, I'll look into it.

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



[Proto-Scripty] Re: Ajax.Updated DIV seems to still have the same innerHTML...

2009-01-08 Thread Ian R



On Jan 8, 4:09 am, SGD danny.g...@googlemail.com wrote:
 Try new Ajax.Updater(this.id, as you have to pass the id of an
 element, not the element itself.


Oh!  I thought you could pass either the ID or an element reference...
in fact, the code seems to work either way, so maybe that's true.



 You can optimize your code by just having:

 $$('[contenteditable=true]').each(function(el) {

 new Ajax.Updater(el.id,'loader.php',{parameters: {field:
 el.id}, onComplete: function(){
alert('check #2: ' + el.innerHTML);
   }
   });
   });


This works really well, and thank you, but I have a need to call this
function in multiple places (like, both on page load and on a button
click, and maybe some other places)... which is not a problem, I've
taken the meat of it out and placed it in a function called load(el),
and I'm calling that function in this loop and I can call it
elsewhere, and I can continue from here in this realm.

However, what I *thought* I was trying to do was develop my
editfield as an object, add the appropriate properties and methods
and things, and then call these functions as el.load() rather than load
(el).  I suppose there is not a ton of benefit from this, other than
to increase my fluency with OOP and to allow for subclassing and
method overriding.

I would really like to know more about this, though, and in particular
how one can take existing HTML (like my DIVs) and apply such an
object to it... the example that I keep coming back to is how one can
take an existing UL and say:

Sortable.create(el);

And then that UL has methods and properties of a Sortable.  HOWEVER: I
would like to have an instance which I can call in events.

Once again, I have talked myself dizzy and I'm not quite sure what I'm
saying anymore.  If any of this makes sense, I would love to be
directed to some sort of document that I could read on the subject, or
if anyone could advise me on a decent search string, I have been
looking this up but I am not 100% sure I'm using the correct terms.

Thanks so much!  I am very excited about Prototype!  I didn't realize
how much I liked it until I started messing around with Dojo.
Prototype makes a lot more sense to me, personally.

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



[Proto-Scripty] Ajax.Updated DIV seems to still have the same innerHTML...

2009-01-07 Thread Ian R


Hey all!  I'm sorry, but I've been butting up against this for a day
and a half now, and I'm exhausted.  It seems simple.

Basically, I'm trying to use the WebKit contenteditable attribute to
create a smallish front end for a database... so what I did was put a
few divs on the page and then passing their IDs to a class, which has,
amongst other functions, load()... well, here it is:



var fp_EditField = Class.create({

  initialize: function(el) {
Object.extend(this,el);
  },

  load: function()  {
  alert(('check #1: ' + this.id);
  new Ajax.Updater(this,'loader.php',{parameters: {field:
this.id}, onComplete: function(){
alert('check #2: ' + this.innerHTML);
  }
  });
},

...etc.


and some regular old HTML:

div id=article_title contenteditable=truepJust some average
HTML in here!/p/div


and then inside Event.observe(window,'load'...):


$$('[contenteditable=true]').each(function(el) {

  var ef = new fp_EditField(el);
  ef.load();

  });



Now, for starters, is that a ridiculous way to pass that pre-existing
HTML to my class?   With that Object.extend(this,el) call?  And then
also iterating through all the contenteditable DIVs... using the same
ef for each of them is surely a mistake...

And further... an earlier version of my code (before I was using
onComplete), the innerHTML was being reported as being the same as it
was before the Ajax call.  Now, however, Check #1 is giving me the ID
of the DIV, and Check #2 is undefined.

Can somebody set me straight?  I hope I'm being clear, I'm feeling
REALLY cloudy about this right now.  I feel like I've explored so many
avenues that I can't keep them straight anymore.  I've tried things
like Element.update() but it seems like perhaps there is a disconnect
between the actual instance of the DIV and the one that I'm trying to
operate on...

Ok!  Thanks in advance!
Ian R
--~--~-~--~~~---~--~~
You received 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] Behaviour.js/Event.Observe: how to make it work when it's in an Ajax.Updater-updated element?

2008-12-11 Thread Ian R


Hey all!

So.  This has come up several times since I've been using Prototype/
Behaviour.  I feel like it must have been covered before but I can't
find it anywhere and I'm worried that I don't quite know what to
search for:

Say, for example, I have an unordered list.  In my initial page, I
have Behaviour rules set up, read from a separate JS file, which
change the className when I mouseover, and change it back when I
mouseout.  This works fine.

I have another element, a button, and when I click that button it
triggers an Ajax.Update of my list, pulling contents from a PHP file.
Also works fine.

But now, my new updated list doesn't respond to the Behaviour rules.
Were I to add, into the HTML, onmouseover and onmouseout attributes,
it would work fine.  But it is not registering the Behaviour.  It does
not seem to matter if the JS is loaded in the PHP page or not.

I'm noticing that the Behaviour page is gone and there doesn't seem to
be any reference to it at all on Ben Nolan's site.  I know I could/
should be using Event.Observe but it doesn't seem to matter, though
I'll admit my tinkering with Event.Observe was less than deft.

Any ideas?  Any help at all would be much appreciated.  I'm just
coming out of a brief flirtation with Dojo and I'm remembering how
much I like Prototype/Script.aculo.us.  It just makes more sense to
me!  ...Except for this one thing.

Ian



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