[Proto-Scripty] Re: $F() cannot get radio button values?

2009-07-30 Thread Pong

I found a solution in the following link

but is that means $F is only for textbox?


http://proto-scripty.wikidot.com/prototype:tip-fetching-radio-button-value

Element.addMethods('form',{
   getCheckedRadioValue: function (formElement, name) {
 formElement = $(formElement);
 var checkedElement = formElement
   .select('input[name='+name+'][type=radio]') //gather all radio
inputs with provided /name/
   .find(function(inputElem){ return inputElem.checked;}); //find
first checked element
 if (checkedElement) {
   return checkedElement.getValue(); //return iths value if found
 } else {
   return null;
 }
   }//end of getCheckedRadioValue

 });



On Jul 30, 10:35 am, vtsuper vtsu...@gmail.com wrote:
 I have a simple question, is $F() cannot get radio button values?

 Should I use the old method document.form.xxx[0].checked to check the
 value???
--~--~-~--~~~---~--~~
You received 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] Event onDrop on Sortable class

2009-07-30 Thread Christophe

Hello,

I am using the Sortable class for handling drag  drop between 3
different columns. In my code, I would like to trigger some method
calls just after the drag is ended.

I was then looking for an onDrop option, but it doesn't seem to be
taken into account.

Is this option supposed to be handled by Sortable, if not, do you have
another option that could help ?

Thx in advance !

Christophe

--~--~-~--~~~---~--~~
You received 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: problems with observe mouseover and mouseout

2009-07-30 Thread Christophe

I have a realy similar issue as this one, but more on the mouseout
event. Effectively, if I observe a mouseout on a ul, every time my
mouse goes from one li to the other, a mouseout event is triggered.

I tried to make a check in the target function to see which element
was doing the call, but I didn't always receive the ul...

Is this how it's supposed to be done ? Has anyone an example somewhere
of a mouseout use (on an element with children elements) ?

Kind regards,
Christophe

On 17 juil, 09:37, David Behler d.beh...@gmail.com wrote:
 Try this:http://www.prototypejs.org/api/event/findElement

 $$(.superlist li).invoke(observe, mouseover, function(event) {
     alert(|Event.findElement(event, 'li')|.inspect().escapeHTML()
 |);
 |});

 That should return the li element instead of a div.

 David

  Hello everyone.

  I've basically got this HTML code:

  ul class=superlist
    li class=foo id=bar
      div class=foobarsome content/div
      div class=contentsome more content/div
      div class=actionssome actions/div
    /li
  /ul

  and this JS code:

  $$(.superlist li).invoke(observe, mouseover, function(event) {
      alert(event.element().inspect().escapeHTML());
  });

  So now the thing is, that the event.element() method does NOT (as I
  would expect) return the li element, but any of the nested elements
  instead. Which might be a div class=foobar or a div
  class=content.

  That results in two problems for me:
  1. I want to toggle the visibility of li.actions for the li hovered.
  It shall become visible on mouseover and unvisible onmouseout. That
  doesn't work since anytime I move over one of the li's nested
  elements, the mouse-events get triggered. Although (from my point of
  view) I'm never leaving that element, since they are indeed children
  of the li.

  2. (similar to the first one) I do always need to know which li
  element was hovered (so that I can determine which .actions div shall
  be toggled but don't know any good way to achieve this.

  I've run through similar problems like this several times but could
  never find a good solution.
  Hope anyone here can help me out :-)

--~--~-~--~~~---~--~~
You received 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: problems with observe mouseover and mouseout

2009-07-30 Thread T.J. Crowder

Hi,

 I have a realy similar issue as this one, but more on the mouseout
 event. Effectively, if I observe a mouseout on a ul, every time my
 mouse goes from one li to the other, a mouseout event is triggered.

That's right, that's how mouseout is supposed to work, but it's a real
pain.

What you probably really want is mouseenter and mouseleave, rather
than mouseover and mouseout.  mouseenter and mouseleave are IE-only
events (yes, IE does some things better than other browsers), but
Prototype 1.6.1 (currently on Release Candidate 3[1]) emulates them on
all supported browsers.  If you can't use 1.6.1 yet (and there are
outstanding issues), you might be able to study the code to see how
it's done.  Basically, it's a matter of checking (via
event.relatedTarget) whether the mouse is going out from one
descendant element to another (or from a descendant back to the main
one) and ignoring that; similarly, if you're doing mouseovers, when
handling them you need to check whether you're seeing a mouseover for
the element you're already over (since mouseover happens repeated as
the mouse moves over the element).

[1] http://prototypejs.org/download

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 29, 11:04 pm, Christophe cdebuss...@gmail.com wrote:
 I have a realy similar issue as this one, but more on the mouseout
 event. Effectively, if I observe a mouseout on a ul, every time my
 mouse goes from one li to the other, a mouseout event is triggered.

 I tried to make a check in the target function to see which element
 was doing the call, but I didn't always receive the ul...

 Is this how it's supposed to be done ? Has anyone an example somewhere
 of a mouseout use (on an element with children elements) ?

 Kind regards,
 Christophe

 On 17 juil, 09:37, David Behler d.beh...@gmail.com wrote:



  Try this:http://www.prototypejs.org/api/event/findElement

  $$(.superlist li).invoke(observe, mouseover, function(event) {
      alert(|Event.findElement(event, 'li')|.inspect().escapeHTML()
  |);
  |});

  That should return the li element instead of a div.

  David

   Hello everyone.

   I've basically got this HTML code:

   ul class=superlist
     li class=foo id=bar
       div class=foobarsome content/div
       div class=contentsome more content/div
       div class=actionssome actions/div
     /li
   /ul

   and this JS code:

   $$(.superlist li).invoke(observe, mouseover, function(event) {
       alert(event.element().inspect().escapeHTML());
   });

   So now the thing is, that the event.element() method does NOT (as I
   would expect) return the li element, but any of the nested elements
   instead. Which might be a div class=foobar or a div
   class=content.

   That results in two problems for me:
   1. I want to toggle the visibility of li.actions for the li hovered.
   It shall become visible on mouseover and unvisible onmouseout. That
   doesn't work since anytime I move over one of the li's nested
   elements, the mouse-events get triggered. Although (from my point of
   view) I'm never leaving that element, since they are indeed children
   of the li.

   2. (similar to the first one) I do always need to know which li
   element was hovered (so that I can determine which .actions div shall
   be toggled but don't know any good way to achieve this.

   I've run through similar problems like this several times but could
   never find a good solution.
   Hope anyone here can help me out :-)
--~--~-~--~~~---~--~~
You received 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] support for svg element?

2009-07-30 Thread Cédric

Hello all,

This is my first time here. I've been using prototype.js for several
years now, and still love it :-) I've recently found a project named
Raphaël (http://raphaeljs.com) and started playing with it.

But I have a problem with the canvas svg element used by Raphael. I
don't know a lot about the way Firefox lets us embed svg elements
inside html documents, so I was surprised to find that
Element.viewportOffset doesn't work, or any other Position methods for
that matter, while event handlers and several other js things work as
usual.

Take a look at this test page for Firefox 3.5:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/
TR/html4/strict.dtd
html
head
title/title
script type=text/javascript src=http://ajax.googleapis.com/ajax/
libs/prototype/1.6.0.3/prototype.js/script
script type=text/javascript
Event.observe(window,load, function (e) {
var canvas = document.createElementNS(http://www.w3.org/2000/svg;,
svg);
canvas.setAttribute(width, 512px);
canvas.setAttribute(height, 342px);
$(container).appendChild(canvas);
alert(Element.viewportOffset(canvas));
alert(Element.viewportOffset($(test)));
});
/script
/head
body style=margin:0px
div id=container style=padding:10px;margin:20pxdiv id=test/
div/div
/body
/html

Why can't I get the offset of the canvas element? Is there a fix or a
workaround? What is special about the SVGSVGElement?

--~--~-~--~~~---~--~~
You received 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-30 Thread Eirik

I encountered this error in all versions of IE8 without non-alpha IDs.
After a lot of debugging and head scratching i discovered that if you
register an observer on the 'dom:load' event in a constructor
(initialize) thats supposed to fire one of the object methods (like
'this.recolour()') it will end up as an infinite loop in IE6, IE7 and
IE8 causing IE to report a stack overflow and invalid argument at this
line.

This is the closest i could find to a thread on this problem, so i am
writing up my discoveries here just in case other developers encounter
this.

This behavior was present in Prototype 1.6.0 and at least 16.1rc3,
these are the versions I've worked with.

Best regards,
Eirik

On Jul 23, 1:28 pm, Jeff jtaylor...@gmail.com 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.

 On Jul 14, 6:37 am, adamski adam.elemen...@gmail.com wrote:

  We're now going through the enjoyable task of getting our app working
  in IE, 6-8 we are aiming for.

  We just downloaded the latest prototype RC3, which seems to fix a few
  errors, however, I am getting this error on page load, IE8 only:

  Message: Invalid argument.
  Line: 4501
  Char: 9
  Code: 0
  URI:http://bgp.brightgreen.local/javascripts/prototype.js?1247565795

  and also from scriptaculous effects.js:

  Message: Exception thrown and not caught
  Line: 485
  Char: 24
  Code: 0
  URI:http://bgp.brightgreen.local/javascripts/effects.js

  Anyone else come across these?

--~--~-~--~~~---~--~~
You received 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-30 Thread T.J. Crowder

Hi,

 ...if you
 register an observer on the 'dom:load' event in a constructor
 (initialize) thats supposed to fire one of the object methods (like
 'this.recolour()') it will end up as an infinite loop in IE6, IE7 and
 IE8...

Can you post a small, self-contained, complete example demonstrating
the problem?  (Perhaps using http://pastie.org for formatting.)
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 30, 9:21 am, Eirik korkon...@gmail.com wrote:
 I encountered this error in all versions of IE8 without non-alpha IDs.
 After a lot of debugging and head scratching i discovered that if you
 register an observer on the 'dom:load' event in a constructor
 (initialize) thats supposed to fire one of the object methods (like
 'this.recolour()') it will end up as an infinite loop in IE6, IE7 and
 IE8 causing IE to report a stack overflow and invalid argument at this
 line.

 This is the closest i could find to a thread on this problem, so i am
 writing up my discoveries here just in case other developers encounter
 this.

 This behavior was present in Prototype 1.6.0 and at least 16.1rc3,
 these are the versions I've worked with.

 Best regards,
 Eirik

 On Jul 23, 1:28 pm, Jeff jtaylor...@gmail.com 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.

  On Jul 14, 6:37 am, adamski adam.elemen...@gmail.com wrote:

   We're now going through the enjoyable task of getting our app working
   in IE, 6-8 we are aiming for.

   We just downloaded the latest prototype RC3, which seems to fix a few
   errors, however, I am getting this error on page load, IE8 only:

   Message: Invalid argument.
   Line: 4501
   Char: 9
   Code: 0
   URI:http://bgp.brightgreen.local/javascripts/prototype.js?1247565795

   and also from scriptaculous effects.js:

   Message: Exception thrown and not caught
   Line: 485
   Char: 24
   Code: 0
   URI:http://bgp.brightgreen.local/javascripts/effects.js

   Anyone else come across these?
--~--~-~--~~~---~--~~
You received 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.Morph query

2009-07-30 Thread Andrew Dodd

I'm not really sure how to, I've been messing with it for a couple of
days to no avail.

I have been trying to use a variable to achieve this so that th
onClick does the following in this order:

1./ Reset the morph effect on the lastPlayed element
2./ Apply the morph effect to the clicked element
3./ Set the lastPlayed variable to match the id of the clicked
element.

Among other errors I've recieved is that lastPlayed is undefined but I
think this may be down to me not knowing how to use a variable instead
of an element id in the morph statment.

Cheers
Andy


On Jul 28, 10:39 pm, Andy Daykin daykina...@gmail.com wrote:
 Why don't you use an array to store all of the elements that have been
 clicked and treat it like a queue?

 --
 From: Andrew Dodd a...@slicethepie.com
 Sent: Tuesday, July 28, 2009 7:02 AM
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Subject: [Proto-Scripty] Effect.Morph query



  Hi

  I page with multiple elements each of which are highlighted
  (individually) onclick.

  I would like the morph effect to be removed from the previous element
  when a new one is clicked (highlighted).

  I won't know what the id of the previous element was though, is there
  a way to achieve this?

  Cheers
  Andy
--~--~-~--~~~---~--~~
You received 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.Morph query

2009-07-30 Thread Alex McAuley

Can you give an example of your code in a pastebin and i will ammend it to 
do what it needs to.

Regards

Alex Mcauley
http://www.thevacancymarket.com

- Original Message - 
From: Andrew Dodd a...@slicethepie.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, July 30, 2009 10:23 AM
Subject: [Proto-Scripty] Re: Effect.Morph query



I'm not really sure how to, I've been messing with it for a couple of
days to no avail.

I have been trying to use a variable to achieve this so that th
onClick does the following in this order:

1./ Reset the morph effect on the lastPlayed element
2./ Apply the morph effect to the clicked element
3./ Set the lastPlayed variable to match the id of the clicked
element.

Among other errors I've recieved is that lastPlayed is undefined but I
think this may be down to me not knowing how to use a variable instead
of an element id in the morph statment.

Cheers
Andy


On Jul 28, 10:39 pm, Andy Daykin daykina...@gmail.com wrote:
 Why don't you use an array to store all of the elements that have been
 clicked and treat it like a queue?

 --
 From: Andrew Dodd a...@slicethepie.com
 Sent: Tuesday, July 28, 2009 7:02 AM
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Subject: [Proto-Scripty] Effect.Morph query



  Hi

  I page with multiple elements each of which are highlighted
  (individually) onclick.

  I would like the morph effect to be removed from the previous element
  when a new one is clicked (highlighted).

  I won't know what the id of the previous element was though, is there
  a way to achieve this?

  Cheers
  Andy



--~--~-~--~~~---~--~~
You received 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: Event onDrop on Sortable class

2009-07-30 Thread Alex McAuley

There is some options in draggable

onEnd: function() {}

HTH


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Christophe cdebuss...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, July 29, 2009 10:53 PM
Subject: [Proto-Scripty] Event onDrop on Sortable class



 Hello,

 I am using the Sortable class for handling drag  drop between 3
 different columns. In my code, I would like to trigger some method
 calls just after the drag is ended.

 I was then looking for an onDrop option, but it doesn't seem to be
 taken into account.

 Is this option supposed to be handled by Sortable, if not, do you have
 another option that could help ?

 Thx in advance !

 Christophe

 
 


--~--~-~--~~~---~--~~
You received 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-30 Thread ferion

You are right Mr. Fine.
But altering the source of prototype itself ist critical if you do
want to update the library constantly. I would need to change the
fragment every new release.
My version is dirty, but until the browser behave differently i need
to use this.

Thx
Joker

--~--~-~--~~~---~--~~
You received 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: ternary operators

2009-07-30 Thread Rick Waldron
Drop the parens around the first argument.

function foo(arg) {

return $(arg) ? true : alert('Element Does not exist');  // i commented this
out: false;

}
...



On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


 In my usual Not enough coffee moments i just used an If/Else instead lol

 Not sure why i was trying to cut code using a tenary ...

 We live and learn

 Sorry for useless post


 Alex Mcauley
 http://www.thevacancymarket.com


 - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, July 28, 2009 4:51 PM
 Subject: [Proto-Scripty] ternary operators


 
  Afternoon guys
 
  Is it possible in javascript to give out 2 answers to a tenary
  opertor (doesnt make sense i know - see below)
 
  function foo(arg) {
 
  return ($(arg)) ? true : alert('Element Does not exist');false;
 
  }
  ...
  (wrapped in window loaded function)
 
  foo('baz'); // doesnt exist so i want it to alert the
  alert and return false to halt the script...
 
 
  div id=bar/div
 
 
 
  Is this the right way to do it in the operator or cant it be done
  and no i dont want to make 2 functions i would like it in one if it
  can be done.
 
  Regards
  Alex Mcauley
 
  http://www.thevacancymarket.com
  
 


 


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

2009-07-30 Thread Alex McAuley
Sorry you missed the point i was trying to achieve.

I wanted the operator to in essence evaluate 2 responses for example.

alert('Element Does not exist'); alert('The second responsee');

However it cannot be achieved so it must be done usung if/else..

Regards

Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Thursday, July 30, 2009 1:18 PM
  Subject: [Proto-Scripty] Re: ternary operators



  Drop the parens around the first argument.

  function foo(arg) {

  return $(arg) ? true : alert('Element Does not exist');  // i commented this 
out: false;

  }
  ...




  On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


In my usual Not enough coffee moments i just used an If/Else instead lol

Not sure why i was trying to cut code using a tenary ...

We live and learn

Sorry for useless post



Alex Mcauley
http://www.thevacancymarket.com



- Original Message -
From: Jeztah webmas...@thecarmarketplace.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Tuesday, July 28, 2009 4:51 PM
Subject: [Proto-Scripty] ternary operators



 Afternoon guys

 Is it possible in javascript to give out 2 answers to a tenary
 opertor (doesnt make sense i know - see below)

 function foo(arg) {

 return ($(arg)) ? true : alert('Element Does not exist');false;

 }
 ...
 (wrapped in window loaded function)

 foo('baz'); // doesnt exist so i want it to alert the
 alert and return false to halt the script...


 div id=bar/div



 Is this the right way to do it in the operator or cant it be done
 and no i dont want to make 2 functions i would like it in one if it
 can be done.

 Regards
 Alex Mcauley

 http://www.thevacancymarket.com
 







  

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

2009-07-30 Thread Celso

Unfortunately I am no expert in prototype.
I can not believe that someone has developed a prototype mask!
I try to use prototype and jquery together,
Works: http://docs.jquery.com/Using_jQuery_with_Other_Libraries
But .. the plugin does not works.

On 29 jul, 18:27, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 why not just port the jquery one... wont take long !
 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Celso cels...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, July 29, 2009 10:22 PM
 Subject: [Proto-Scripty] Re: Masked Input in Prototype

 something like this:http://digitalbush.com/projects/masked-input-plugin

 On 24 jul, 06:48, Richard Quadling rquadl...@googlemail.com wrote:
  2009/7/23 Matt Foster mattfoste...@gmail.com:

   You must further define your idea of masked input

  http://www.google.com/search?q=define%3A+masked+inputie=utf-8oe=utf...

   On Jul 23, 3:58 pm, Celso cels...@gmail.com wrote:
   Anyone know a masked input in prototype?

   Thanks,
   Celso.

  An inputmask[1] is where you can say enter text in a form like ...

  AA nn nn nn A

  You would be able to type 2 letters, 6 numbers and then 1 letter. The
  case would be forced to upper case and the spacing would be automatic.

  BO 52 91 91 V

  for example

  OR

  Are you talking about hiding the input? Like input type=password ?

  Regards,

  Richard.

  [1]http://www.google.co.uk/search?q=define:+input+mask

  --
  -
  Richard Quadling
  Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731
  Standing on the shoulders of some very clever giants!
  ZOPA :http://uk.zopa.com/member/RQuadling
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



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

2009-07-30 Thread Eirik

This will reproduce the issues sometimes (http://pastie.org/565352),
but it is not consistent. In principle its the same code that cause
the invalid handeler at line 4501, but it only produces the issue
occationaly. When running it causes a stack overflow at first, and
then produce the error at line 4501.

var CrashDemo = Class.create({
initialize: function() {
document.observe('dom:load', this.dummyMethod());
},
dummyMethod: function() {
var test = $('demo');
test.removeClassName('name');
}
});

Seeing how the original script does not behave the same way as
yesterday, though it still produces this crash occationaly, I am
starting to suspect that it is my system that somehow is the root
cause of this problem.

The above code seem to work as expected on FF, Opera and Chrome.

Eirik

On 30 Jul, 11:08, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

  ...if you
  register an observer on the 'dom:load' event in a constructor
  (initialize) thats supposed to fire one of the object methods (like
  'this.recolour()') it will end up as an infinite loop in IE6, IE7 and
  IE8...

 Can you post a small, self-contained, complete example demonstrating
 the problem?  (Perhaps usinghttp://pastie.orgfor formatting.)
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Jul 30, 9:21 am, Eirik korkon...@gmail.com wrote:



  I encountered this error in all versions of IE8 without non-alpha IDs.
  After a lot of debugging and head scratching i discovered that if you
  register an observer on the 'dom:load' event in a constructor
  (initialize) thats supposed to fire one of the object methods (like
  'this.recolour()') it will end up as an infinite loop in IE6, IE7 and
  IE8 causing IE to report a stack overflow and invalid argument at this
  line.

  This is the closest i could find to a thread on this problem, so i am
  writing up my discoveries here just in case other developers encounter
  this.

  This behavior was present in Prototype 1.6.0 and at least 16.1rc3,
  these are the versions I've worked with.

  Best regards,
  Eirik

  On Jul 23, 1:28 pm, Jeff jtaylor...@gmail.com 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.

   On Jul 14, 6:37 am, adamski adam.elemen...@gmail.com wrote:

We're now going through the enjoyable task of getting our app working
in IE, 6-8 we are aiming for.

We just downloaded the latest prototype RC3, which seems to fix a few
errors, however, I am getting this error on page load, IE8 only:

Message: Invalid argument.
Line: 4501
Char: 9
Code: 0
URI:http://bgp.brightgreen.local/javascripts/prototype.js?1247565795

and also from scriptaculous effects.js:

Message: Exception thrown and not caught
Line: 485
Char: 24
Code: 0
URI:http://bgp.brightgreen.local/javascripts/effects.js

Anyone else come across these?
--~--~-~--~~~---~--~~
You received 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] Eventchain click and drag

2009-07-30 Thread ferion

Hello everybody,

another problem occured while coding complex stuff.
I try to bind 2 events on one Element like this:

this.Dragger = new Draggable($(this.widgetToolId),{revert:
this.shallIToolRevert.bind(this), onStart:this.startDrag.bind(this),
onEnd:this.stopDrag.bind(this), change:this.whileDrag.bind(this),
onDrag:this.whileDrag.bind(this), ghosting:true, starteffect:null});

$(this.widgetToolId).observe('click',this.toolClick.bind(this));

This works fine on FF but won't work on IE. The Exploder seems to
think that a click is a very short drag without movement.
If I'm using mouseup as listener this works fine, but then alway BOTH
events are fired.

Is there anyway around?
--~--~-~--~~~---~--~~
You received 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 to use scripts without clicks

2009-07-30 Thread David McGlone

On Thursday 30 July 2009 01:51:52 am DJ Mangus wrote:


 Quite a few errors there, first off you are naming the function, you
 cannot do that if you are using a function literal.  Secondly for
 Effect.Appear you are probably best off using it directly on the DOM
 element after it's been extended with $().  And lastly your braces and
 parentheses are incorrect.  The following should work (though I
 drycoded it).

 document.observe(dom:loaded, function() {
$('show').Appear({ duration: 3.0 });
 });

 I'm not 100% sure that Effect.Appear will work properly with an inline
 style like that, if not then remove the inline style and call the
 document.observe thusly to hide it before rendering and then fade it
 in over 3 seconds:

 document.observe(dom:loaded, function() {
$('show').Hide();
$('show').Appear({ duration: 3.0 });
 });

Thank you DJ, you did get me going in the right direction. After much much 
MUCH hacking away I finally got this code to work:

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

Effect.Appear('appear', { duration: 7.0 });

 });


-- 
Blessings,
David M.
http://www.dmcentral.net

--~--~-~--~~~---~--~~
You received 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: License question

2009-07-30 Thread jdetaeye


I am faced with the same question as the initial author.

The file prototype.js has the following text in the header:
   Prototype is freely distributable under the terms of an MIT-style
license.

IANAL (I am not a lawyer) but what does MIT-style mean?
Is it in any way different from a strict MIT license?  (I believe it
isn't)

To distribute a copy of prototype.js in my project, it might be best
to replace the header in the file with the actual license text.
The MIT license actually asks that start quotethe above copyright
notice and this permission notice shall be included in all copies or
substantial portions of the Software.end quote.

Regards,

Johan

On Jul 27, 12:25 pm, Tobie Langel tobie.lan...@gmail.com wrote:
 Hi,

 You'll find the exact terms of the Prototype license 
 here:http://github.com/sstephenson/prototype/blob/add69978e09653808aedec43...

 It's an MIT license.

 Hope this clarifies your issue.

 Best,

 Tobie

 On Jul 26, 8:37 pm, hussayn hussayn.dabb...@saxess.com wrote:



  Hi;

  I am investigating in using Prototype within another open source
  application (the Scarab issue tracking system). Scarab is distributed
  under the apache-2 license. I do not see any contradictions with the
  Prototype license, but in order to be sure that i am acting correctly,
  i would like to get an explicit grant to use and redistribute
  Prototype with Scarab. Only then we can use Prototype to enhance our
  frontend.

  But i can't figure out, whom i should ask for such a grant. So maybe
  you are listening here and can help ?

  thanks,
  Regards,
  Hussayn- Hide quoted text -

 - Show quoted text -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-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] Any javascript included in document loaded in div with Updater isn't recognized

2009-07-30 Thread DJJQ

Hello.
I use the Updater function to load a div on the page with contents
from a php file. The load works just fine, however in the browser I
have noticed that new javascript written in the new php isn't
recognized.

However javascript code from the original page is recognized in the
new div.

I understand that perhaps the ordinary script tagging in the head of
the new document doesn't work. Well is there any prototype function to
load the javascript codes?

Best Regards, Joel H.

--~--~-~--~~~---~--~~
You received 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: Any javascript included in document loaded in div with Updater isn't recognized

2009-07-30 Thread T.J. Crowder

Hi,

You're looking for the evalScripts option of Ajax.Updater[1], which in
turn uses Element#update[2] to update the target container, which in
turn (!) uses String#evalScripts[3] to eval the scripts.  Scripts must
be inline in script tags, they cannot have src attributes loading
external scripts.  If you want to do that, there's an article[4] on
the unofficial wiki that talks about how to do that.

[1] http://prototypejs.org/api/ajax/updater
[2] http://prototypejs.org/api/element/update
[3] http://prototypejs.org/api/string/evalScripts
[4] http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynamically

FWIW, I suggest giving the API a good front-to-back read.  Takes about
an hour, and will save you lots of time and trouble in the long run.

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 30, 3:31 pm, DJJQ joll...@hotmail.com wrote:
 Hello.
 I use the Updater function to load a div on the page with contents
 from a php file. The load works just fine, however in the browser I
 have noticed that new javascript written in the new php isn't
 recognized.

 However javascript code from the original page is recognized in the
 new div.

 I understand that perhaps the ordinary script tagging in the head of
 the new document doesn't work. Well is there any prototype function to
 load the javascript codes?

 Best Regards, Joel H.
--~--~-~--~~~---~--~~
You received 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: Using a prototype function in dynamic content.

2009-07-30 Thread Drum

Ok, thanks. I think I understand the reasoning here, but I can't get
my actual example to work.

This is the script as it appears in the initially loaded page and also
as it is in the html snippets bought in by ajax.

div id=kwdisp0101some keyword/div

script
if(editor0101){
editor0101.dispose();
editor0101 = undefined;
}
var editor0101;
editor0101 = new Ajax.InPlaceEditor('kwdisp0101','./addkw.php',{size:
17,callback: function(form, value) { return 'oldwd=some
%20keywordidx=section-idmyparam=' + escape(value)}});\n;
/script

The 0101 is an example, I do this for each keyword in the list and
derive the numbers from some php code, net will be 0102, 0103 0201
0202 c. This goes for both the editor var name in the js, and for the
dic id in the HTML.

Have I missed or misunderstood something? (it's been a long day...)






--~--~-~--~~~---~--~~
You received 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: Using a prototype function in dynamic content.

2009-07-30 Thread T.J. Crowder

Hi,

Really close. :-)  But you're running afoul of how eval handles the
var statement.  (If you'd just left the var statement out entirely, it
probably would have worked thanks to the horror of implicit globals
[1], but you'd be cluttering up the window namespace something
fierce.)  Also,  you're repeating a lot of code.

Instead, I'd suggest declaring a hash of editors on your main page
(not the stuff loaded dynamically) and a function for adding or
replacing one; and may as well wrap those up into just the one global
symbol:

In your main script:
* * * *
var ipeManager = {
editors: {},

addOrReplaceEditor: function(id, url, size, paramstr) {
var eds;

eds = this.editors;

if (eds[id]) {
eds[id].dispose();
eds[id] = undefined; // Or: delete eds[id];
}

eds[id] = new Ajax.InPlaceEditor(
id,
url,
{
size: size,
callback: function(form, value) {
return paramstr + escape(value);
}
}
);
}
};
* * * *

Then the dynamic stuff can be much simpler:
* * * *
div id=kwdisp0101some keyword/div
script
ipeManager.addOrReplaceEditor(
   kwdisp0101,
   './addkw.php',
   17,
   'oldwd=some%20keywordidx=section-idmyparam='
);
/script
* * * *

[1] http://blog.niftysnippets.org/2008/03/horror-of-implicit-globals.html

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jul 30, 5:51 pm, Drum csteph2...@gmail.com wrote:
 Ok, thanks. I think I understand the reasoning here, but I can't get
 my actual example to work.

 This is the script as it appears in the initially loaded page and also
 as it is in the html snippets bought in by ajax.

 div id=kwdisp0101some keyword/div

 script
 if(editor0101){
 editor0101.dispose();
 editor0101 = undefined;}

 var editor0101;
 editor0101 = new Ajax.InPlaceEditor('kwdisp0101','./addkw.php',{size:
 17,callback: function(form, value) { return 'oldwd=some
 %20keywordidx=section-idmyparam=' + escape(value)}});\n;
 /script

 The 0101 is an example, I do this for each keyword in the list and
 derive the numbers from some php code, net will be 0102, 0103 0201
 0202 c. This goes for both the editor var name in the js, and for the
 dic id in the HTML.

 Have I missed or misunderstood something? (it's been a long day...)
--~--~-~--~~~---~--~~
You received 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: ternary operators

2009-07-30 Thread Rick Waldron
Huh?

Jeztah == Alex?

On Thu, Jul 30, 2009 at 8:37 AM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:

  Sorry you missed the point i was trying to achieve.

 I wanted the operator to in essence evaluate 2 responses for example.

 alert('Element Does not exist'); alert('The second responsee');

 However it cannot be achieved so it must be done usung if/else..

 Regards

 Alex Mcauley
 http://www.thevacancymarket.com

 - Original Message -
 *From:* Rick Waldron waldron.r...@gmail.com
 *To:* prototype-scriptaculous@googlegroups.com
 *Sent:* Thursday, July 30, 2009 1:18 PM
 *Subject:* [Proto-Scripty] Re: ternary operators


 Drop the parens around the first argument.

 function foo(arg) {

 return $(arg) ? true : alert('Element Does not exist');  // i commented
 this out: false;

 }
 ...



 On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
 webmas...@thecarmarketplace.com wrote:


 In my usual Not enough coffee moments i just used an If/Else instead lol

 Not sure why i was trying to cut code using a tenary ...

 We live and learn

 Sorry for useless post


 Alex Mcauley
 http://www.thevacancymarket.com


  - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, July 28, 2009 4:51 PM
 Subject: [Proto-Scripty] ternary operators


 
  Afternoon guys
 
  Is it possible in javascript to give out 2 answers to a tenary
  opertor (doesnt make sense i know - see below)
 
  function foo(arg) {
 
  return ($(arg)) ? true : alert('Element Does not exist');false;
 
  }
  ...
  (wrapped in window loaded function)
 
  foo('baz'); // doesnt exist so i want it to alert the
  alert and return false to halt the script...
 
 
  div id=bar/div
 
 
 
  Is this the right way to do it in the operator or cant it be done
  and no i dont want to make 2 functions i would like it in one if it
  can be done.
 
  Regards
  Alex Mcauley
 
  http://www.thevacancymarket.com
  
 




 


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

2009-07-30 Thread Alex McAuley
the original post is signed with my name !!
Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Thursday, July 30, 2009 7:31 PM
  Subject: [Proto-Scripty] Re: ternary operators


  Huh?

  Jeztah == Alex?


  On Thu, Jul 30, 2009 at 8:37 AM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:

Sorry you missed the point i was trying to achieve.

I wanted the operator to in essence evaluate 2 responses for example.

alert('Element Does not exist'); alert('The second responsee');

However it cannot be achieved so it must be done usung if/else..

Regards

Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Thursday, July 30, 2009 1:18 PM
  Subject: [Proto-Scripty] Re: ternary operators



  Drop the parens around the first argument.

  function foo(arg) {

  return $(arg) ? true : alert('Element Does not exist');  // i commented 
this out: false;

  }
  ...




  On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


In my usual Not enough coffee moments i just used an If/Else instead 
lol

Not sure why i was trying to cut code using a tenary ...

We live and learn

Sorry for useless post



Alex Mcauley
http://www.thevacancymarket.com



- Original Message -
From: Jeztah webmas...@thecarmarketplace.com
To: Prototype  script.aculo.us 
prototype-scriptaculous@googlegroups.com
Sent: Tuesday, July 28, 2009 4:51 PM
Subject: [Proto-Scripty] ternary operators



 Afternoon guys

 Is it possible in javascript to give out 2 answers to a tenary
 opertor (doesnt make sense i know - see below)

 function foo(arg) {

 return ($(arg)) ? true : alert('Element Does not exist');false;

 }
 ...
 (wrapped in window loaded function)

 foo('baz'); // doesnt exist so i want it to alert the
 alert and return false to halt the script...


 div id=bar/div



 Is this the right way to do it in the operator or cant it be done
 and no i dont want to make 2 functions i would like it in one if it
 can be done.

 Regards
 Alex Mcauley

 http://www.thevacancymarket.com
 










  

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

2009-07-30 Thread Rick Waldron
Hehe. I guess i missed that.

I read through these pretty quickly...

On Thu, Jul 30, 2009 at 2:35 PM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:

  the original post is signed with my name !!
 Alex Mcauley
 http://www.thevacancymarket.com

 - Original Message -
 *From:* Rick Waldron waldron.r...@gmail.com
 *To:* prototype-scriptaculous@googlegroups.com
 *Sent:* Thursday, July 30, 2009 7:31 PM
 *Subject:* [Proto-Scripty] Re: ternary operators

 Huh?

 Jeztah == Alex?

 On Thu, Jul 30, 2009 at 8:37 AM, Alex McAuley 
 webmas...@thecarmarketplace.com wrote:

  Sorry you missed the point i was trying to achieve.

 I wanted the operator to in essence evaluate 2 responses for example.

 alert('Element Does not exist'); alert('The second responsee');

 However it cannot be achieved so it must be done usung if/else..

 Regards

 Alex Mcauley
 http://www.thevacancymarket.com

 - Original Message -
 *From:* Rick Waldron waldron.r...@gmail.com
 *To:* prototype-scriptaculous@googlegroups.com
 *Sent:* Thursday, July 30, 2009 1:18 PM
 *Subject:* [Proto-Scripty] Re: ternary operators


 Drop the parens around the first argument.

 function foo(arg) {

 return $(arg) ? true : alert('Element Does not exist');  // i commented
 this out: false;

 }
 ...



 On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
 webmas...@thecarmarketplace.com wrote:


 In my usual Not enough coffee moments i just used an If/Else instead
 lol

 Not sure why i was trying to cut code using a tenary ...

 We live and learn

 Sorry for useless post


 Alex Mcauley
 http://www.thevacancymarket.com


  - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, July 28, 2009 4:51 PM
 Subject: [Proto-Scripty] ternary operators


 
  Afternoon guys
 
  Is it possible in javascript to give out 2 answers to a tenary
  opertor (doesnt make sense i know - see below)
 
  function foo(arg) {
 
  return ($(arg)) ? true : alert('Element Does not exist');false;
 
  }
  ...
  (wrapped in window loaded function)
 
  foo('baz'); // doesnt exist so i want it to alert the
  alert and return false to halt the script...
 
 
  div id=bar/div
 
 
 
  Is this the right way to do it in the operator or cant it be done
  and no i dont want to make 2 functions i would like it in one if it
  can be done.
 
  Regards
  Alex Mcauley
 
  http://www.thevacancymarket.com
  
 






 


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

2009-07-30 Thread Alex McAuley
Me too !!!

Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Thursday, July 30, 2009 7:39 PM
  Subject: [Proto-Scripty] Re: ternary operators


  Hehe. I guess i missed that.

  I read through these pretty quickly...


  On Thu, Jul 30, 2009 at 2:35 PM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:

the original post is signed with my name !!
Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Thursday, July 30, 2009 7:31 PM
  Subject: [Proto-Scripty] Re: ternary operators


  Huh?

  Jeztah == Alex?


  On Thu, Jul 30, 2009 at 8:37 AM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:

Sorry you missed the point i was trying to achieve.

I wanted the operator to in essence evaluate 2 responses for example.

alert('Element Does not exist'); alert('The second responsee');

However it cannot be achieved so it must be done usung if/else..

Regards

Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Thursday, July 30, 2009 1:18 PM
  Subject: [Proto-Scripty] Re: ternary operators



  Drop the parens around the first argument.

  function foo(arg) {

  return $(arg) ? true : alert('Element Does not exist');  // i 
commented this out: false;

  }
  ...




  On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


In my usual Not enough coffee moments i just used an If/Else 
instead lol

Not sure why i was trying to cut code using a tenary ...

We live and learn

Sorry for useless post



Alex Mcauley
http://www.thevacancymarket.com



- Original Message -
From: Jeztah webmas...@thecarmarketplace.com
To: Prototype  script.aculo.us 
prototype-scriptaculous@googlegroups.com
Sent: Tuesday, July 28, 2009 4:51 PM
Subject: [Proto-Scripty] ternary operators



 Afternoon guys

 Is it possible in javascript to give out 2 answers to a tenary
 opertor (doesnt make sense i know - see below)

 function foo(arg) {

 return ($(arg)) ? true : alert('Element Does not exist');false;

 }
 ...
 (wrapped in window loaded function)

 foo('baz'); // doesnt exist so i want it to alert the
 alert and return false to halt the script...


 div id=bar/div



 Is this the right way to do it in the operator or cant it be 
done
 and no i dont want to make 2 functions i would like it in one if 
it
 can be done.

 Regards
 Alex Mcauley

 http://www.thevacancymarket.com
 













  

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

2009-07-30 Thread Christophe

Yeah... But I am using a sortable...

What do you mean ?

Cheers,
Christophe

On Jul 30, 12:25 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 There is some options in draggable

 onEnd: function() {}

 HTH

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Christophe cdebuss...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, July 29, 2009 10:53 PM
 Subject: [Proto-Scripty] Event onDrop on Sortable class

  Hello,

  I am using the Sortable class for handling drag  drop between 3
  different columns. In my code, I would like to trigger some method
  calls just after the drag is ended.

  I was then looking for an onDrop option, but it doesn't seem to be
  taken into account.

  Is this option supposed to be handled by Sortable, if not, do you have
  another option that could help ?

  Thx in advance !

  Christophe
--~--~-~--~~~---~--~~
You received 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: ternary operators

2009-07-30 Thread T.J. Crowder

Hi Alex,

 However it cannot be achieved so it must be done usung if/else..

Well, this is JavaScript, there's almost always a way.  I can think of
four off the top of my head that keep it in a single expression -- but
all of them are much worse (most of them much, much, much worse) than
using an if/else. ;-)  The four are:

1. Massage the return value of the first thing you want to do to force
it to be the return value you want.  Actually, in your specific case,
you don't have to anything:

return $(arg) ? true : alert('Element Does not exist');

alert has no return value, hence your function returns either true or
undefined, which is good enough for anything branching on its return
value (undefined is falsey, after all).  If you really want a false,
use !! to force it.

Blech.

2. If you wanted to return something other than false, and if the
first part has an invariant result, you could manipulate that return
value to be falsey and use the OR operator, which is much more
powerful in JavaScript than in most languages (more here[1]):

return $(arg) ? It's there : (alert('Element Does not exist') ||
It's not there);

or, demonstrating manipulation:

return $(arg) ? It's there : (!setTimeout(...) || It's not there);

...since setTimeout returns a non-zero number; !setTimeout is false
and so the return value (for that second operand) is It's not there.

Blech blech.

3. Wrap the two-part bit in an on-the-fly function:

return $(arg) ? true : (function(){ alert('Element Does not exist');
return false;})());

Blech blech cough.

4. Use eval (!):

return $(arg) ? true : eval(alert('Element Does not exist'); return
false;);

Blech blech cough retch.

I bet there are others.

So:  *Possible*, but if/else is just a way better way to go. ;-)

[1] http://blog.niftysnippets.org/2008/02/javascripts-curiously-powerful-or.html
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jul 30, 1:37 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Sorry you missed the point i was trying to achieve.

 I wanted the operator to in essence evaluate 2 responses for example.

 alert('Element Does not exist'); alert('The second responsee');

 However it cannot be achieved so it must be done usung if/else..

 Regards

 Alex Mcauleyhttp://www.thevacancymarket.com



   - Original Message -
   From: Rick Waldron
   To: prototype-scriptaculous@googlegroups.com
   Sent: Thursday, July 30, 2009 1:18 PM
   Subject: [Proto-Scripty] Re: ternary operators

   Drop the parens around the first argument.

   function foo(arg) {

   return $(arg) ? true : alert('Element Does not exist');  // i commented 
 this out: false;

   }
   ...

   On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
 webmas...@thecarmarketplace.com wrote:

     In my usual Not enough coffee moments i just used an If/Else instead lol

     Not sure why i was trying to cut code using a tenary ...

     We live and learn

     Sorry for useless post

     Alex Mcauley
    http://www.thevacancymarket.com

     - Original Message -
     From: Jeztah webmas...@thecarmarketplace.com
     To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
     Sent: Tuesday, July 28, 2009 4:51 PM
     Subject: [Proto-Scripty] ternary operators

      Afternoon guys

      Is it possible in javascript to give out 2 answers to a tenary
      opertor (doesnt make sense i know - see below)

      function foo(arg) {

      return ($(arg)) ? true : alert('Element Does not exist');false;

      }
      ...
      (wrapped in window loaded function)

      foo('baz'); // doesnt exist so i want it to alert the
      alert and return false to halt the script...

      div id=bar/div

      Is this the right way to do it in the operator or cant it be done
      and no i dont want to make 2 functions i would like it in one if it
      can be done.

      Regards
      Alex Mcauley

     http://www.thevacancymarket.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-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] Escaping Input

2009-07-30 Thread infringer

I have a form, I've been doing this in javascript:

entry = $('busCalForm').serialize(true);
entry = JSON.stringify(entry);
new Ajax.Request(modules/buscal/processes/saveBooking.php, {
 parameters: year= + year + recnum= + busmstr_id + json= +
entry,
 onSuccess: busCal.gotEntry.bind(this),
 onFailure: busCal.gotFailure.bind(this)
 });

But i have a user that has typed a # in one of the fields, and the
script dies.  How can I effectively escape an entire form, without
having to get the value and escape them individually?  Is there a
command I'm missing?

-David
--~--~-~--~~~---~--~~
You received 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: ternary operators

2009-07-30 Thread Alex McAuley

thanks TJ,

The alert() was just an example - perhaps a bad one! ... i did not however 
consider the || version.

Regards

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: T.J. Crowder t...@crowdersoftware.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, July 30, 2009 8:26 PM
Subject: [Proto-Scripty] Re: ternary operators



Hi Alex,

 However it cannot be achieved so it must be done usung if/else..

Well, this is JavaScript, there's almost always a way.  I can think of
four off the top of my head that keep it in a single expression -- but
all of them are much worse (most of them much, much, much worse) than
using an if/else. ;-)  The four are:

1. Massage the return value of the first thing you want to do to force
it to be the return value you want.  Actually, in your specific case,
you don't have to anything:

return $(arg) ? true : alert('Element Does not exist');

alert has no return value, hence your function returns either true or
undefined, which is good enough for anything branching on its return
value (undefined is falsey, after all).  If you really want a false,
use !! to force it.

Blech.

2. If you wanted to return something other than false, and if the
first part has an invariant result, you could manipulate that return
value to be falsey and use the OR operator, which is much more
powerful in JavaScript than in most languages (more here[1]):

return $(arg) ? It's there : (alert('Element Does not exist') ||
It's not there);

or, demonstrating manipulation:

return $(arg) ? It's there : (!setTimeout(...) || It's not there);

...since setTimeout returns a non-zero number; !setTimeout is false
and so the return value (for that second operand) is It's not there.

Blech blech.

3. Wrap the two-part bit in an on-the-fly function:

return $(arg) ? true : (function(){ alert('Element Does not exist');
return false;})());

Blech blech cough.

4. Use eval (!):

return $(arg) ? true : eval(alert('Element Does not exist'); return
false;);

Blech blech cough retch.

I bet there are others.

So:  *Possible*, but if/else is just a way better way to go. ;-)

[1] 
http://blog.niftysnippets.org/2008/02/javascripts-curiously-powerful-or.html
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jul 30, 1:37 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Sorry you missed the point i was trying to achieve.

 I wanted the operator to in essence evaluate 2 responses for example.

 alert('Element Does not exist'); alert('The second responsee');

 However it cannot be achieved so it must be done usung if/else..

 Regards

 Alex Mcauleyhttp://www.thevacancymarket.com



 - Original Message -
 From: Rick Waldron
 To: prototype-scriptaculous@googlegroups.com
 Sent: Thursday, July 30, 2009 1:18 PM
 Subject: [Proto-Scripty] Re: ternary operators

 Drop the parens around the first argument.

 function foo(arg) {

 return $(arg) ? true : alert('Element Does not exist'); // i commented 
 this out: false;

 }
 ...

 On Tue, Jul 28, 2009 at 12:02 PM, Alex McAuley 
 webmas...@thecarmarketplace.com wrote:

 In my usual Not enough coffee moments i just used an If/Else instead lol

 Not sure why i was trying to cut code using a tenary ...

 We live and learn

 Sorry for useless post

 Alex Mcauley
 http://www.thevacancymarket.com

 - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, July 28, 2009 4:51 PM
 Subject: [Proto-Scripty] ternary operators

  Afternoon guys

  Is it possible in javascript to give out 2 answers to a tenary
  opertor (doesnt make sense i know - see below)

  function foo(arg) {

  return ($(arg)) ? true : alert('Element Does not exist');false;

  }
  ...
  (wrapped in window loaded function)

  foo('baz'); // doesnt exist so i want it to alert the
  alert and return false to halt the script...

  div id=bar/div

  Is this the right way to do it in the operator or cant it be done
  and no i dont want to make 2 functions i would like it in one if it
  can be done.

  Regards
  Alex Mcauley

 http://www.thevacancymarket.com



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

2009-07-30 Thread T.J. Crowder

Hi,

You're sending an unencoded string (which happens to be in JSON
format) as part of your parameters string, which is meant to be URL-
encoded data.  A # sign is the least of your problems. ;-)  You'll
want to encode that with JavaScript's encodeURIComponent function[1].

Somewhat OT, but as of 1.6 (at least), the preferred way to provide
options to Ajax.Request is as an object.  If you give it a string,
that string will be converted to an object, and then later converted
back into a string.  Yes, really. :-)  Also, String has a toJSON
function you can use instead of JSON.stringify (not that it matters).

So:

entry = encodeURIComponent($('busCalForm').serialize(true).toJSON());
new Ajax.Request(
modules/buscal/processes/saveBooking.php, {
parameters: {
year: year,
recnum: busmstr_id,
json: entry
},
onSuccess: busCal.gotEntry.bind(this),
onFailure: busCal.gotFailure.bind(this)
});

 How can I effectively escape an entire form, without
 having to get the value and escape them individually?  Is there a
 command I'm missing?

That's not quite what your code is doing; you're sending the form
fields as a JSON-encoded string in a parameter called json.  If you
just want to send the form fields, and you don't need them to arrive
at the other end as a JSON string, there's a *much* shorter way:
Form#request[2].  Assuming that your form element has the
saveBooking.php as its action attribute:

$('busCalForm').request({
parameters: {
year: year,
recnum: busmstr_id
},
onSuccess: busCal.gotEntry.bind(this),
onFailure: busCal.gotFailure.bind(this)
});

The form fields will no longer be JSON-ified (but will be properly URL-
encoded), they'll arrive as individual parameters on the request.  If
the form field doesn't have saveBooking.php as its action and you
can't change that, the Ajax.Request can still be simplified:

params = $('busCalForm').serialize(true);
params.year = year;
params.recnum = busmstr_id;
new Ajax.Request(
modules/buscal/processes/saveBooking.php, {
parameters: params,
onSuccess: busCal.gotEntry.bind(this),
onFailure: busCal.gotFailure.bind(this)
});

[1] 
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/encodeURIComponent
[2] http://prototypejs.org/api/form/request

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jul 30, 8:27 pm, infringer infrin...@gmail.com wrote:
 I have a form, I've been doing this in javascript:

 entry = $('busCalForm').serialize(true);
 entry = JSON.stringify(entry);
 new Ajax.Request(modules/buscal/processes/saveBooking.php, {
          parameters: year= + year + recnum= + busmstr_id + json= +
 entry,
          onSuccess: busCal.gotEntry.bind(this),
          onFailure: busCal.gotFailure.bind(this)
          });

 But i have a user that has typed a # in one of the fields, and the
 script dies.  How can I effectively escape an entire form, without
 having to get the value and escape them individually?  Is there a
 command I'm missing?

 -David
--~--~-~--~~~---~--~~
You received 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: Escaping Input

2009-07-30 Thread T.J. Crowder

Sorry, I got my wires crossed half-way through the first one of
those.  You can't use String#toJSON, it's not a string!  Doh.
Correcting my first example:

entry = encodeURIComponent(Object.toJSON($('busCalForm').serialize
(true)));
new Ajax.Request(
modules/buscal/processes/saveBooking.php, {
parameters: {
year: year,
recnum: busmstr_id,
json: entry
},
onSuccess: busCal.gotEntry.bind(this),
onFailure: busCal.gotFailure.bind(this)

});

Sorry 'bout that.

-- T.J. :-)

On Jul 30, 8:55 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You're sending an unencoded string (which happens to be in JSON
 format) as part of your parameters string, which is meant to be URL-
 encoded data.  A # sign is the least of your problems. ;-)  You'll
 want to encode that with JavaScript's encodeURIComponent function[1].

 Somewhat OT, but as of 1.6 (at least), the preferred way to provide
 options to Ajax.Request is as an object.  If you give it a string,
 that string will be converted to an object, and then later converted
 back into a string.  Yes, really. :-)  Also, String has a toJSON
 function you can use instead of JSON.stringify (not that it matters).

 So:

 entry = encodeURIComponent($('busCalForm').serialize(true).toJSON());
 new Ajax.Request(
     modules/buscal/processes/saveBooking.php, {
     parameters: {
         year: year,
         recnum: busmstr_id,
         json: entry
     },
     onSuccess: busCal.gotEntry.bind(this),
     onFailure: busCal.gotFailure.bind(this)

 });
  How can I effectively escape an entire form, without
  having to get the value and escape them individually?  Is there a
  command I'm missing?

 That's not quite what your code is doing; you're sending the form
 fields as a JSON-encoded string in a parameter called json.  If you
 just want to send the form fields, and you don't need them to arrive
 at the other end as a JSON string, there's a *much* shorter way:
 Form#request[2].  Assuming that your form element has the
 saveBooking.php as its action attribute:

 $('busCalForm').request({
     parameters: {
         year: year,
         recnum: busmstr_id
     },
     onSuccess: busCal.gotEntry.bind(this),
     onFailure: busCal.gotFailure.bind(this)

 });

 The form fields will no longer be JSON-ified (but will be properly URL-
 encoded), they'll arrive as individual parameters on the request.  If
 the form field doesn't have saveBooking.php as its action and you
 can't change that, the Ajax.Request can still be simplified:

 params = $('busCalForm').serialize(true);
 params.year = year;
 params.recnum = busmstr_id;
 new Ajax.Request(
     modules/buscal/processes/saveBooking.php, {
     parameters: params,
     onSuccess: busCal.gotEntry.bind(this),
     onFailure: busCal.gotFailure.bind(this)

 });

 [1]https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global...
 [2]http://prototypejs.org/api/form/request

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Jul 30, 8:27 pm, infringer infrin...@gmail.com wrote:



  I have a form, I've been doing this in javascript:

  entry = $('busCalForm').serialize(true);
  entry = JSON.stringify(entry);
  new Ajax.Request(modules/buscal/processes/saveBooking.php, {
           parameters: year= + year + recnum= + busmstr_id + json= +
  entry,
           onSuccess: busCal.gotEntry.bind(this),
           onFailure: busCal.gotFailure.bind(this)
           });

  But i have a user that has typed a # in one of the fields, and the
  script dies.  How can I effectively escape an entire form, without
  having to get the value and escape them individually?  Is there a
  command I'm missing?

  -David
--~--~-~--~~~---~--~~
You received 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] Newbee question : Compatibility with javascript 1.5

2009-07-30 Thread Christophe

Hi there,

Apologies to everybody if my question is offending in any way, but
this is my first post to such a group.

I'm a occasional user of Prototype and Scriptaculous and pretty happy
with these tools.

However, I'm facing an issue for which I can find any answer around:

I created some pages that work pretty well on modern browsers such as
FF 3 or 3.5 and Safari 3 or 4, but I'm asked to make them run on some
special Internet devices that run only Mozilla Firefox 1.7 with
Javascript 1.5

So my question is : what are the requirements of Prototype 1.6 and
Scriptaculous 1.8, will my pages run well on such an old browser.
If not, is there an older version of Prototype and/or Scriptaculous
that will answer my problem.

Thanks in advance

Christophe

--~--~-~--~~~---~--~~
You received 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: $F() cannot get radio button values?

2009-07-30 Thread mr_justin

The value is returned from radio buttons and checkboxes if the item is
checked/selected. This behavior mimics browser behavior when these
fields are submitted via a traditional form submit.

If $F() returns null for a checkbox or radio button, then that item is
not selected and it's value should be treated as such.

-justin
--~--~-~--~~~---~--~~
You received 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: Newbee question : Compatibility with javascript 1.5

2009-07-30 Thread Rick Waldron
That sounds like fun... i like device app development. Can you tell us what
device you're working with? That will be helpful

Rick

On Thu, Jul 30, 2009 at 3:55 PM, Christophe christophe.dec...@gmail.comwrote:


 Hi there,

 Apologies to everybody if my question is offending in any way, but
 this is my first post to such a group.

 I'm a occasional user of Prototype and Scriptaculous and pretty happy
 with these tools.

 However, I'm facing an issue for which I can find any answer around:

 I created some pages that work pretty well on modern browsers such as
 FF 3 or 3.5 and Safari 3 or 4, but I'm asked to make them run on some
 special Internet devices that run only Mozilla Firefox 1.7 with
 Javascript 1.5

 So my question is : what are the requirements of Prototype 1.6 and
 Scriptaculous 1.8, will my pages run well on such an old browser.
 If not, is there an older version of Prototype and/or Scriptaculous
 that will answer my problem.

 Thanks in advance

 Christophe

 


--~--~-~--~~~---~--~~
You received 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: $F() cannot get radio button values?

2009-07-30 Thread Walter Lee Davis

I suspect you probably want to get the radio *group* by name, and then  
see which (if any) of its members is currently checked.

$$('input[name=yourRadioGroup]:checked').first() will get the  
element or false. To explicitly get the value, try this:

var myValue = ($$(input[name=yourRadioGroup]:checked).first()) ?
$$(input[name=yourRadioGroup]:checked).first().getValue() : '';

Walter


On Jul 30, 2009, at 4:07 PM, mr_justin wrote:


 The value is returned from radio buttons and checkboxes if the item is
 checked/selected. This behavior mimics browser behavior when these
 fields are submitted via a traditional form submit.

 If $F() returns null for a checkbox or radio button, then that item is
 not selected and it's value should be treated as such.

 -justin
 


--~--~-~--~~~---~--~~
You received 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 sum value from input?

2009-07-30 Thread Miguel Beltran R.
Thanks for the advice.

2009/7/29 T.J. Crowder t...@crowdersoftware.com


 Hi,

 That version seems okay, except it parses the number twice (first for
 isNaN, then again in parseFloat).  There's also no need to check for a
 blank string, '' can't be converted to a number and so parsing it will
 result in NaN.  Also, parseFloat defaults to base 10, so no need for
 that param (but by all means include it if you think it makes the code
 clearer).

 var i;
 var suma = 0;
 var valor;
 for (i = 1; i = 24; i++) {
 valor = parseFloat($F('quincena_'+ i).strip());
if (!isNaN(valor)) {
suma += valor;
}
 }

 Note that parseFloat will stop at the first invalid character, so this
 doesn't do much in the way of validation.  For instance, if the field
 contains 15x5, parseFloat will return 15, not NaN.  If you need real
 validation, you'll probably want RegExps to test for valid patterns.
 A web search should do it, if you need to take it that far.

 FWIW,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available


 On Jul 29, 12:56 am, Miguel Beltran R. yourpa...@gmail.com wrote:
  Hi list
 
  I have the next code, but how can be made better?
 
   var i;
   var suma=0;
   var valor;
   for(i=1; i=24; i++){
  valor=$F( 'quincena_'+ i).strip();
  if(valor!=''  !(isNaN(valor))){
 suma+=parseFloat(valor,10);
  }
 }
 
  --
  
  Lo bueno de vivir un dia mas
  es saber que nos queda un dia menos de vida
 



-- 

Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida

--~--~-~--~~~---~--~~
You received 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: Using a prototype function in dynamic content.

2009-07-30 Thread Drum

Sorry, but it's still not working for me.

I have my main page as it initially loads with this in the HEAD

script language=javascript
type=text/javascript
var ipeManager = {
editors: {},
addOrReplaceEditor: function(id, url, size, paramstr){
var eds;
eds = this.editors;
if (eds[id]) {
eds[id].dispose();
delete eds[id]; // Or: eds[id] = undefined;
}
eds[id] = new Ajax.InPlaceEditor(id,url,{size: size,callback:
function(form, value) {return paramstr + escape(value);}});
}
};
/script

Then, in the body of the document is the keyword list:

div id=kwdisp0101A keyword/div
...a bunch of other stuff...
script
ipeManager.addOrReplaceEditor('kwdisp0101','./addkw.php',
17,'oldwd=A%20keywordidx=subject-idmyparam=');
/script

div id=kwdisp0102Another keyword/div
...a bunch of other stuff...
script
ipeManager.addOrReplaceEditor('kwdisp0102','./addkw.php',
17,'oldwd=A%20keywordidx=subject-idmyparam=');
/script

div id=kwdisp0103Yet another keyword/div
...a bunch of other stuff...
script
ipeManager.addOrReplaceEditor('kwdisp0103','./addkw.php',
17,'oldwd=Yet%20another%20keywordidx=subject-idmyparam=');
/script

The content called in by ajax is basically a copy of the keyword list,
and has exactly the same structure and IDs as the list above.

On loading the initial page it works fine, but when the ajax content
has replaced the original list, it no longer works. No Firebug errors,
no nothing.

Did I miss something out?

--~--~-~--~~~---~--~~
You received 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] What object is it exactly that's passed to the Ajax.Request onSuccess callback?

2009-07-30 Thread David Karr

I've briefly surveyed the documentation, and I really can't figure out
exactly what object is passed to the onSuccess callback of the
Ajax.Request() method.  I've read one statement that says it's the
XMLHttpRequest object, so they called the parameter request, which
seems very odd for an Ajax callback.

--~--~-~--~~~---~--~~
You received 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: What object is it exactly that's passed to the Ajax.Request onSuccess callback?

2009-07-30 Thread T.J. Crowder

Hi,

Yes, those docs are messed up (out of date, I think, and will be fixed
by the new documentation stuff in 1.6.1).  It's an Ajax.Response[1].

[1] http://prototypejs.org/api/ajax/response

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 31, 3:57 am, David Karr davidmichaelk...@gmail.com wrote:
 I've briefly surveyed the documentation, and I really can't figure out
 exactly what object is passed to the onSuccess callback of the
 Ajax.Request() method.  I've read one statement that says it's the
 XMLHttpRequest object, so they called the parameter request, which
 seems very odd for an Ajax callback.
--~--~-~--~~~---~--~~
You received 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: ternary operators

2009-07-30 Thread T.J. Crowder

Hi,

I thought that too, but tried it and it didn't work, so I figured I
had to be misremembering.  Turns out I just messed up my test. :-)

-- T.J.

On Jul 31, 5:49 am, kangax kan...@gmail.com wrote:
 On Jul 30, 3:26 pm, T.J. Crowder t...@crowdersoftware.com wrote:





  Hi Alex,

   However it cannot be achieved so it must be done usung if/else..

  Well, this is JavaScript, there's almost always a way.  I can think of
  four off the top of my head that keep it in a single expression -- but
  all of them are much worse (most of them much, much, much worse) than
  using an if/else. ;-)  The four are:

  1. Massage the return value of the first thing you want to do to force
  it to be the return value you want.  Actually, in your specific case,
  you don't have to anything:

  return $(arg) ? true : alert('Element Does not exist');

  alert has no return value, hence your function returns either true or
  undefined, which is good enough for anything branching on its return
  value (undefined is falsey, after all).  If you really want a false,
  use !! to force it.

  Blech.

  2. If you wanted to return something other than false, and if the
  first part has an invariant result, you could manipulate that return
  value to be falsey and use the OR operator, which is much more
  powerful in JavaScript than in most languages (more here[1]):

  return $(arg) ? It's there : (alert('Element Does not exist') ||
  It's not there);

  or, demonstrating manipulation:

  return $(arg) ? It's there : (!setTimeout(...) || It's not there);

  ...since setTimeout returns a non-zero number; !setTimeout is false
  and so the return value (for that second operand) is It's not there.

  Blech blech.

  3. Wrap the two-part bit in an on-the-fly function:

  return $(arg) ? true : (function(){ alert('Element Does not exist');
  return false;})());

  Blech blech cough.

  4. Use eval (!):

  return $(arg) ? true : eval(alert('Element Does not exist'); return
  false;);

  Blech blech cough retch.

  I bet there are others.

 You can use comma operator (which evaluates all of its expressions
 left to right and evaluates itself to the last expression):

 return $(arg) ? true : alert('...'), false;

 [...]

 --
 kangax
--~--~-~--~~~---~--~~
You received 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
-~--~~~~--~~--~--~---