[Proto-Scripty] Re: Request works in IE but not Firefox, Chrome

2010-05-06 Thread T.J. Crowder
Hi,

You're setting the contentType of the *request* to application/json,
but that's not what you're sending; what you're sending is URL-encoded
data. The "contentType" option refers to your request, not the
response.[1] It's up to the server to set the content type of the
response.

> 2. onComplete occurs and the login_response function is sent - however
> the response variable is null

The response argument *itself* is null? I've never seen that happen,
and looking at the Prototype code, I'm not seeing how it /can/ happen.
Do you mean that response.responseJSON is null? That could certainly
happen, if the server isn't returning the correct content-type on the
response. If it's response.responseJSON that's null, what does
response.responseText look like? If it contains the JSON string, you
can set the evalJSON option on your request to 'force' to force
Prototype to evaluate the response as JSON even if the server doesn't
return the correct content type.

Finally: You're using an onComplete handler and an onFailure handler.
That means you'll get two alerts when things fail, first one from
onFailure, then another one from onComplete, because onComplete
happens regardless of what happens to the request. You probably want
to change onComplete to onSuccess. You might find this article[2] on
the unofficial wiki helpful.

So what I'd suggest is:

* Remove the contentType option from your request; the default is
fine.
* Change onComplete to onSuccess.
* If that doesn't fix it, and the response argument is coming back but
it's response.responseJSON that's null, add 'evalJSON: "force"' to
your options.

Hope one of those is it!

[1] http://api.prototypejs.org/ajax/
[2] http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests

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


On May 7, 1:06 am, hellboy1975  wrote:
> Hi Guys,
>
> I'm relatively new to AJAX and Prototype, so please be gentle with me.
>
> I've been working on getting what I expected was a simple AJAX request
> into my site, and the code I've created looks right to me, however
> only works in Internet Explorer.  Initially I thought the problem
> might be Prototype, but I quickly did the same thing in jQuery, and
> that also fails in the same way.
>
> All the code is being run on localhost, and it's basically a PHP site
> running with Smarty, communicating with a Web Service responding with
> JSON.
>
> Firstly, the HTML:
>
> 
> 
>         VA PHP Test Site
>
>     

[Proto-Scripty] Re: Request works in IE but not Firefox, Chrome

2010-05-06 Thread hellboy1975
Ok, ignore all of that - I managed to find the problem which waiting
for the message to be moderated.

Turns out the problem I was using:



instead of



Not sure why, but IE doesn't mind using type='submit' on the button,
but Firefox & Chrome won't.

On May 7, 9:06 am, hellboy1975  wrote:
> Hi Guys,
>
> I'm relatively new to AJAX and Prototype, so please be gentle with me.
>
> I've been working on getting what I expected was a simple AJAX request
> into my site, and the code I've created looks right to me, however
> only works in Internet Explorer.  Initially I thought the problem
> might be Prototype, but I quickly did the same thing in jQuery, and
> that also fails in the same way.
>
> All the code is being run on localhost, and it's basically a PHP site
> running with Smarty, communicating with a Web Service responding with
> JSON.
>
> Firstly, the HTML:
>
> 
> 
>         VA PHP Test Site
>
>     

[Proto-Scripty] Request works in IE but not Firefox, Chrome

2010-05-06 Thread hellboy1975
Hi Guys,

I'm relatively new to AJAX and Prototype, so please be gentle with me.

I've been working on getting what I expected was a simple AJAX request
into my site, and the code I've created looks right to me, however
only works in Internet Explorer.  Initially I thought the problem
might be Prototype, but I quickly did the same thing in jQuery, and
that also fails in the same way.

All the code is being run on localhost, and it's basically a PHP site
running with Smarty, communicating with a Web Service responding with
JSON.

Firstly, the HTML:



VA PHP Test Site






VA PHP

Please Log In:

User:


Password:








And the Javascript:

function login_response(response) {
var login = response.responseJSON;
alert("State: " + login.LoginState + "\nAccount: " + login.Account +
"\nUser: " + login.User + "\nPassword: " + login.User);
}



function login_staff()
{
var loginString;
var url='LoginWSO.wso/Login_Staff/JSON';

// this sets loginString to "Person=value1&Password=value2"
loginString = Form.serialize("login-form");

// creates and sends the request.
// pops an alert if there is an error, or fires login_response when
complete
var myAjax = new Ajax.Request(
url,
{method: 'POST', parameters: loginString,  contentType:
'application/json',
onComplete: function(response){alert('response ' +
response.responseJSON); },
onFailure: function(){ alert('Something went 
wrong...'); }
}
);
}

Just to sum it it, while using the Chrome debugger I found the
following:
1. login_staff is fired, and appears to collect the various settings
ok
2. onComplete occurs and the login_response function is sent - however
the response variable is null
3. As a result the alert appears, but is largely blank

In Internet Explorer, the alert pops up, and contains the correct
response.
In Firefox the behaviour is much the same as Chrome, however if I put
a break point on, and take my time stepping through the code, the
correct alert does actually appear.  If it let it run normally
however, it behaves the same as Chrome.

My initial thoughts were that same origin policy, but given that it's
all on localhost, I'm not sure why this would be the case.

Any suggestions gratefully appreciated!

Thanks,
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-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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: Canceling a custom effect using click or mousewheel

2010-05-06 Thread Joe Williams
OK, so I solved the problem I think. I created a queue called
'dialogue' in the call to Effect.Scroll, and then put the following
code in my Rails application.js file:

Event.observe(window, 'load', function() {
Event.observe($('dialogue_window'), 'click', function()
{ Effect.Queues.get('dialogue').invoke('cancel'); })
Event.observe($('dialogue_window'), 'mousewheel', function()
{ Effect.Queues.get('dialogue').invoke('cancel'); })
Event.observe($('dialogue_window'), 'DOMMouseScroll', function()
{ Effect.Queues.get('dialogue').invoke('cancel'); })
});

This keeps the custom effect and the observer/handler code separate,
which seems right.  It also appears to have the desired effect, at
least in FF3.  I'll test it in other browsers tomorrow, but before I
do, does this approach seem reasonable?

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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] Drag n Drop problem in Safari/Chrome and Opera

2010-05-06 Thread jmack159
Hello everyone,

Im working on a project currently using Drag and Drop controls
extensively.
(http://dixonlab.rutgers.edu/tools/faFinder/design.php)

I'm using Prototype 1.6.0.3 and Scriptaculous 1.8.2

In Safari and Chrome (on Windows [4.04 and 4.1.249 respectively] and
OSX) the droppable elements on the right of the page move
*exponentially* far with a small mouse movement during dragging. That
is, when trying to drag one of the divs, a small mouse movement (a few
pixels) results in movement of the div by several hundred pixels,
essentially making the user interafce unusable.

On Opera (10.10), the initial dragging works as expected, but when the
dragged div goes to revert, the div ends up about 1,000 pixels to the
right, and about 300 pixels further down the page than its original
position.

Everything appears to go according to plan with Firefox (v3.6.3) and
IE (8.0.76 - may require compatibility view for some components to be
properly rendered, but drag and drop should still work).

Any idea what is causing this? Thanks in advance for your help!

Josh

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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: Hovering Div Shows a Hidden Div - Prototype

2010-05-06 Thread T.J. Crowder
No worries, glad to help.

Looking at it again, I did see a substantial inefficiency. This code:

$$('div.outer-div').each(function(div) {
div.observe('mouseenter', function() {
this.down('div.inner2').show();
});
div.observe('mouseleave', function() {
this.down('div.inner2').hide();
});
});

Creates separate functions for *each* div's mouseenter and mouseleave
handlers. There's no reason for that, so:

$$('div.outer-div').each(function(div) {
div.observe('mouseenter', outerDivMouseEnter);
div.observe('mouseleave', outerDivMouseLeave);
});

function outerDivMouseEnter() {
this.down('div.inner2').show();
};

function outerDivMouseLeave() {
this.down('div.inner2').hide();
};

FWIW,

-- T.J. :-)

On May 6, 4:51 pm, Pixelflips  wrote:
> Thanks so much for your great response and all the links.
>
> I have tried the solution but so far it doesn't seem to work. I will
> be reviewing everything on my end to make sure I didn't cause the
> problem myself. I will comment again with more info if I cant get it
> to work.
>
> Thanks again!!
>
> On May 6, 12:07 am, "T.J. Crowder"  wrote:
>
>
>
>
>
> > Hi,
>
> > If I'm understanding you, you want to hide the "inner2" divs, but then
> > show them if the "outer-div" divs are hovered. The `mouseenter` and
> > `mouseleave` events can help you with that:
>
> >     $$('div.outer-div').each(function(div) {
> >         div.observe('mouseenter', function() {
> >             this.down('div.inner2').show();
> >         });
> >         div.observe('mouseleave', function() {
> >             this.down('div.inner2').hide();
> >         });
> >     });
>
> > You don't have to worry about two "inner2" divs showing at the same
> > time unless the "outer-div" divs are overlapping, which I suspect they
> > aren't, since `mouseleave` will fire to hide the previous one.
>
> > What I used there:
>
> > $$ to find the outer-divs[1]
> > Enumerable#each to loop through them[2]
> > Event#observe (indirectly through Element#observe) to hook up event
> > handlers[3]
> > Element#down to find the "inner2" div within the outer div[4]
> > Element#show[5] and Element#hide[6]
>
> > [1]http://api.prototypejs.org/language/dollardollar/(thatlink will
> > only work for a little while, it *should* 
> > behttp://api.prototypejs.org/dom/dollardollar/
> > but right now it's wrong)
> > [2]http://api.prototypejs.org/language/enumerable/prototype/each/
> > [3]http://api.prototypejs.org/dom/event/observe/
> > [4]http://api.prototypejs.org/dom/element/down/
> > [5]http://api.prototypejs.org/dom/element/show/
> > [6]http://api.prototypejs.org/dom/element/hide/
>
> > If you haven't already, it's very, very much worth your time to read
> > through the entire API front-to-back. It only takes about an hour.
>
> > HTH,
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / comwww.crowdersoftware.com
>
> > On May 6, 2:05 am, Pixelflips  wrote:
>
> > > I have a few sets of divs that contain three divs set up in the
> > > following way:
>
> > > 
> > > 
> > > 
> > > 
>
> > > 
> > > 
> > > 
> > > 
>
> > > 
> > > 
> > > 
> > > 
>
> > > I have the second inner div of each hidden via the inline style. What
> > > I am trying to accomplish is that when the outer div of any, or
> > > basically any of the content is hovered over then the inner2 would
> > > appear but only one at a time within the outer-div.
>
> > > I am unfamilar with Prototype and having a terrible time trying to get
> > > my head around it.
>
> > > Thanks in advance for any help!!
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Prototype & script.aculo.us" group.
> > > To post to this group, send email to 
> > > prototype-scriptacul...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Prototype & script.aculo.us" group.
> > To post to this group, send email to 
> > prototype-scriptacul...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the 

[Proto-Scripty] how to toggle scriptaculous's move effect?

2010-05-06 Thread Lille
Hi,

I'd like to use the move effect (in Rails) such that an an element
moves between point A and B per toggle. My problem is I don't know how
to encode state in the page so that my toggle function knows which of
the coordinates -- A(x,y) or B(x,y) -- to move the element to.

Simply put, is there an easy way to toggle move back and forth between
two points (in Rails)?

Thanks,

Lille

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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] Canceling a custom effect using click or mousewheel

2010-05-06 Thread Joe Williams
Hi All,

I'm a fairly new prototype and scriptaculous user with limited
javascript experience.  I have been developing with Ruby on Rails for
some time, and found I needed to automatically scroll to the bottom of
a div as part of a series of animated effects.

Since Effect.ScrollTo only affects the whole document, I copied the
custom Effect.Scroll from http://pastie.org/36461, and modified it to
allow scrolling to the bottom of the element.  I have created an
extensions.js file and put the custom effect in there, and it runs
fine.

So here's my situation. I need users to be able to stop the scroll
either by clicking inside the element, or using their mousewheel on
it.  I've read a bunch of documents, including the tips and how-tos on
hooking events at proto-scripty.wikidot.com, and all seem to indicate
that something sort of like this is in order:

Event.observe(element, 'click', someFunctionThatStopsTheEffect)
Event.observe(element, 'mousewheel', someFunctionThatStopsTheEffect)

Questions:

1) Is 'mousewheel' a standard event?  If not, what is the correct way
to access mouse wheel behavior?
2) Can I embed these observers directly into the custom effect?  If
so, what is the proper location (initialize, setup, or update) where
they should reside?
3) If they can go into the custom effect, what's the proper way to
handle the function call?  Could I do something like this:
Event.observe(element, 'click', function() { this.cancel(); })
4) Or, is there some better way to do this entirely?

Thanks so much for any help you can offer.

Here is the code for my version of Effect.Scroll:

Effect.Scroll = Class.create();
Object.extend(Object.extend(Effect.Scroll.prototype,
Effect.Base.prototype), {
  initialize: function(element) {
this.element = $(element);
var options = Object.extend({
  x:0,
  y:0,
  to_bottom: null,
  mode: 'absolute'
} , arguments[1] || {}  );
this.start(options);
  },
  setup: function() {
if (this.options.continuous && !this.element._ext ) {
  this.element.cleanWhitespace();
  this.element._ext=true;
  this.element.appendChild(this.element.firstChild);
}

this.originalLeft=this.element.scrollLeft;
this.originalTop=this.element.scrollTop;

if (this.options.to_bottom) {
  this.options.y = this.element.scrollHeight;
}

if(this.options.mode == 'absolute') {
  this.options.x -= this.originalLeft;
  this.options.y -= this.originalTop;
} else {

}
  },
  update: function(position) {
this.element.scrollLeft = this.options.x * position +
this.originalLeft;
this.element.scrollTop  = this.options.y * position +
this.originalTop;
  }
});

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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: Hovering Div Shows a Hidden Div - Prototype

2010-05-06 Thread Pixelflips
Thanks so much for your great response and all the links.

I have tried the solution but so far it doesn't seem to work. I will
be reviewing everything on my end to make sure I didn't cause the
problem myself. I will comment again with more info if I cant get it
to work.

Thanks again!!

On May 6, 12:07 am, "T.J. Crowder"  wrote:
> Hi,
>
> If I'm understanding you, you want to hide the "inner2" divs, but then
> show them if the "outer-div" divs are hovered. The `mouseenter` and
> `mouseleave` events can help you with that:
>
>     $$('div.outer-div').each(function(div) {
>         div.observe('mouseenter', function() {
>             this.down('div.inner2').show();
>         });
>         div.observe('mouseleave', function() {
>             this.down('div.inner2').hide();
>         });
>     });
>
> You don't have to worry about two "inner2" divs showing at the same
> time unless the "outer-div" divs are overlapping, which I suspect they
> aren't, since `mouseleave` will fire to hide the previous one.
>
> What I used there:
>
> $$ to find the outer-divs[1]
> Enumerable#each to loop through them[2]
> Event#observe (indirectly through Element#observe) to hook up event
> handlers[3]
> Element#down to find the "inner2" div within the outer div[4]
> Element#show[5] and Element#hide[6]
>
> [1]http://api.prototypejs.org/language/dollardollar/(that link will
> only work for a little while, it *should* 
> behttp://api.prototypejs.org/dom/dollardollar/
> but right now it's wrong)
> [2]http://api.prototypejs.org/language/enumerable/prototype/each/
> [3]http://api.prototypejs.org/dom/event/observe/
> [4]http://api.prototypejs.org/dom/element/down/
> [5]http://api.prototypejs.org/dom/element/show/
> [6]http://api.prototypejs.org/dom/element/hide/
>
> If you haven't already, it's very, very much worth your time to read
> through the entire API front-to-back. It only takes about an hour.
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On May 6, 2:05 am, Pixelflips  wrote:
>
>
>
> > I have a few sets of divs that contain three divs set up in the
> > following way:
>
> > 
> > 
> > 
> > 
>
> > 
> > 
> > 
> > 
>
> > 
> > 
> > 
> > 
>
> > I have the second inner div of each hidden via the inline style. What
> > I am trying to accomplish is that when the outer div of any, or
> > basically any of the content is hovered over then the inner2 would
> > appear but only one at a time within the outer-div.
>
> > I am unfamilar with Prototype and having a terrible time trying to get
> > my head around it.
>
> > Thanks in advance for any help!!
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Prototype & script.aculo.us" group.
> > To post to this group, send email to 
> > prototype-scriptacul...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

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



Re: [Proto-Scripty] Re: hash serialization problems

2010-05-06 Thread Guillaume Lepicard
hi,
The way an hash is serialized in json is the correct way i think, what you
want is more an array than an hash...

So you could either use an array

var a = $A();
a.push({"name00": "value00"});
a.push({"name01": "value01"});
and then serialize this array :
Object.toJSON(a);

or if it is too much work, you could serialize your hash this way

var h = $H();
h.set("name00", "value00");
h.set("name01", "value01");
Object.toJSON( h.inject([], function(acc, hashEntry) {
  var tmp = {};
  tmp[hashEntry.key] = hashEntry.value;
  acc.push(tmp);
  return acc;
}));

if you need this functionality at several places, you can add a method to
Hash to serialize the way you want :
Hash.addMethods( {
  myExpectedFormat : function() {
return this.inject([], function(acc, hashEntry) {
  var tmp = {};
  tmp[hashEntry.key] = hashEntry.value;
  acc.push(tmp);
  return acc;
   });
  }
} );
and then everywhere :
Object.toJSON( h.myExpectedFormat() );

On Thu, May 6, 2010 at 4:33 PM, chrysanthe m  wrote:

> Hi
> Can anyone help me understand this?  I can recreate a properly formatted
> JSONArray server-side, but I really want to know why Object.toJSON() didnt
> format it client-side correctly.
>
> On Thu, Apr 29, 2010 at 4:36 PM, chrysanthe m wrote:
>
>> Hi
>> I have created a hash, added to it with set but when try
>> Object.toJSON(myHash) it produces one large JSONObject and not the proper
>> JSONArray format.  I would expect [{name00:value00},{name01:value01}...]
>> What I get is {name00:value00,name01:value00...}.  How do/can I get what I
>> expect?  tia.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>

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



[Proto-Scripty] Re: hash serialization problems

2010-05-06 Thread chrysanthe m
Hi
Can anyone help me understand this?  I can recreate a properly formatted
JSONArray server-side, but I really want to know why Object.toJSON() didnt
format it client-side correctly.

On Thu, Apr 29, 2010 at 4:36 PM, chrysanthe m  wrote:

> Hi
> I have created a hash, added to it with set but when try
> Object.toJSON(myHash) it produces one large JSONObject and not the proper
> JSONArray format.  I would expect [{name00:value00},{name01:value01}...]
> What I get is {name00:value00,name01:value00...}.  How do/can I get what I
> expect?  tia.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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] overflow:hidden DIV Scrolling

2010-05-06 Thread Hariz Soleminio
Hi Guys, 

I'm having hard time googling the DIV scrollto. its like a DIV that's scrolls 
when I click something. 
I did find some code snippets for prototype and scriptacolous. However the 
image and text flickers or distorts when
I hit the event for sliding. Do you have any in mind that could help me with 
this one.

Problem:
1) Want to scroll within a div with a style of overflow:hidden;
2) Scroll images and text by event 
3) Smooth

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, 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: Ajax.Request works - form.request() does not - on IE 8.0

2010-05-06 Thread walther diechmann
Hey Jinsa,

good of you!

Hard pressed to come up with a solution, I ran the HTML (generated by
Formtastic) through validator.w3.org - and turned out the input tag
was not closed properly (  was missing the slash). Posted my
observation to the Formtastic group here on Google - and they pointed
my attention to the DOCTYPE. I use the DOCTYPE suggested by the Rails
framework - but browsers apparently do not interpret the handling of
tags uniformly :(
(really can't say I didn't know that)

Lesson learned:
building documents dynamically using innerHTML - or via Prototype
methods (replace and update) - it is of vital importance to have the
dynamic HTML validated, or selecting a DOCTYPE which will allow for
looser interpretations, at least pertaining to forms manipulation and
Ajax calls.

I have to apologise here! Neither Prototype nor Script.aculo.us is to
blame - and I've been crying wolf for no reason at all.

Please excuse my lack of command in the W3C specs <:(

Cheers,
Walther


On 6 Maj, 10:32, Jinsa  wrote:
> Hey,
>
> Can you put your code in order to have a better view of your problem?
> This kind of request works on IE so it should be a little mistake in
> your code. Just put it there and we will try to help you :)
>
> Bye,
>
> Jinsa.

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



[Proto-Scripty] Re: Ajax.Request works - form.request() does not - on IE 8.0

2010-05-06 Thread Jinsa
Hey,

Can you put your code in order to have a better view of your problem?
This kind of request works on IE so it should be a little mistake in
your code. Just put it there and we will try to help you :)

Bye,

Jinsa.

On May 5, 9:27 am, walther diechmann 
wrote:
> Anyone got a take on this issue?
>
> I have a form which gets loaded dynamically and is POST'ed "behind the
> curtains" using a form.request() on the submit button (in an attempt
> to degrade nicely) -
>
> this works in FF, Opera, Chrome and Safari (on Mac and PC) - but IE?
> Noo...
>
> On IE the request is received server-side - but with no parameters to
> show for its name <:)
>
> (tried a Ajax.Request with Form.serialize() and that is OK)
>
> Cheers,
> Walther
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

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



[Proto-Scripty] Re: Hovering Div Shows a Hidden Div - Prototype

2010-05-06 Thread T.J. Crowder
Hi,

If I'm understanding you, you want to hide the "inner2" divs, but then
show them if the "outer-div" divs are hovered. The `mouseenter` and
`mouseleave` events can help you with that:

$$('div.outer-div').each(function(div) {
div.observe('mouseenter', function() {
this.down('div.inner2').show();
});
div.observe('mouseleave', function() {
this.down('div.inner2').hide();
});
});

You don't have to worry about two "inner2" divs showing at the same
time unless the "outer-div" divs are overlapping, which I suspect they
aren't, since `mouseleave` will fire to hide the previous one.

What I used there:

$$ to find the outer-divs[1]
Enumerable#each to loop through them[2]
Event#observe (indirectly through Element#observe) to hook up event
handlers[3]
Element#down to find the "inner2" div within the outer div[4]
Element#show[5] and Element#hide[6]

[1] http://api.prototypejs.org/language/dollardollar/ (that link will
only work for a little while, it *should* be 
http://api.prototypejs.org/dom/dollardollar/
but right now it's wrong)
[2] http://api.prototypejs.org/language/enumerable/prototype/each/
[3] http://api.prototypejs.org/dom/event/observe/
[4] http://api.prototypejs.org/dom/element/down/
[5] http://api.prototypejs.org/dom/element/show/
[6] http://api.prototypejs.org/dom/element/hide/

If you haven't already, it's very, very much worth your time to read
through the entire API front-to-back. It only takes about an hour.

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

On May 6, 2:05 am, Pixelflips  wrote:
> I have a few sets of divs that contain three divs set up in the
> following way:
>
> 
> 
> 
> 
>
> 
> 
> 
> 
>
> 
> 
> 
> 
>
> I have the second inner div of each hidden via the inline style. What
> I am trying to accomplish is that when the outer div of any, or
> basically any of the content is hovered over then the inner2 would
> appear but only one at a time within the outer-div.
>
> I am unfamilar with Prototype and having a terrible time trying to get
> my head around it.
>
> Thanks in advance for any help!!
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

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



[Proto-Scripty] Hovering Div Shows a Hidden Div - Prototype

2010-05-06 Thread Pixelflips

I have a few sets of divs that contain three divs set up in the
following way:
















I have the second inner div of each hidden via the inline style. What
I am trying to accomplish is that when the outer div of any, or
basically any of the content is hovered over then the inner2 would
appear but only one at a time within the outer-div.

I am unfamilar with Prototype and having a terrible time trying to get
my head around it.

Thanks in advance for any help!!

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