[Proto-Scripty] Re: Change Event Not Firing On Text Field in IE

2009-01-23 Thread T.J. Crowder

Hi,

At the top of the function, you're comparing the field value against
''; but at the bottom if they cancel their change, you're setting it
to this._txtFld.  Should the comparison at the top be against
this._txtFld?  Or should a confirmed change set this._txtFld?  Not
that that would explain it was working in FF and not IE, unless the
testing was done differently.  I'm not seeing an issue with 'change'
not being fired, either on IE6 or IE7.

If that's not it, I'd try picking up with step #3 from this article on
the unofficial wiki:
http://proto-scripty.wikidot.com/faq#xyzprob

BTW, on the focus thing:  You'll probably find that the focus doesn't
shift back to the field if you call focus() from within the change
handler; deferring the call might help, something like this after
resetting the value (don't forget to add a var at the top for
'field'):

field = e.findElement(); // The 1.6 way of doing Event.element(e)
(function(){
field.focus();
}).defer();

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

On Jan 22, 9:39 pm, J. Gregory Wright daecab...@gmail.com wrote:
 So, I have a simple bit of code that asks a user to confirm that they
 want to change the existing value of a text field:

 code
 ...
 Event.observe(this._form['txtFld'], 'change',
 this.txtFldChanged.bindAsEventListener(this), false);
 this._txtFld = this._form['txtFld'].value;
 ...
 function txtFldChanged(e)
 {
   var confirmed = (this._txtFld == '');

   if (! confirmed)
   {
     confirmed = confirm('Are you sure you want to change the value of
 txtFld?');
   }

   if (! confirmed)
   {
     this._form['txtFld'].value = this._txtFld;
     Event.element(e).focus();
   }

   return confirmed;}

 /code

 In FF, this works fine, every time you edit the content of the field.
 In IE, it works once - after that the change event does not fire. I've
 seen some mention of a possible behavior issue in IE having to do with
 modification of the text field value programmatically within the event
 bubble for the field's change event, but nothing concrete.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread coruscant

Hello All,

I want to use Ajax.updater in one of my PHP scripts. I would like to
send all the variables of a form to the server, therefore I use the
form serialize method. Anyway I need to tell the server other
variables that are not and can not be in the form. Is it somehow
possible to do this?

I tried things like:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: $('thisform').serialize(true), {variable1: 'input',
variable2: 'otherinput', variable3: 'somestring'},
  evalScripts: 'true'
  });

Also this way does not work:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: {$('thisform').serialize(true), variable1: 'input',
variable2: 'otherinput', variable3: 'somestring'},
  evalScripts: 'true'
  });

And this way doesn't work either:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: $('thisform').serialize(true),
  parameters: {variable1: 'input', variable2: 'otherinput', variable3:
'somestring'},
  evalScripts: 'true'
  });

Does anybody have an idea?

Thanks in advance.

Benedikt.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread T.J. Crowder

Hi,

Form#serialize[1] returns a Hash object[2] when you call it with
'true' as the getHash parameter (as you are).  So just do that
*before* your Ajax.Updater call, and add your further items to the
Hash, and then pass the Hash into the updater call.

[1] http://prototypejs.org/api/form/serialize
[2] http://prototypejs.org/api/hash

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


On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:
 Hello All,

 I want to use Ajax.updater in one of my PHP scripts. I would like to
 send all the variables of a form to the server, therefore I use the
 form serialize method. Anyway I need to tell the server other
 variables that are not and can not be in the form. Is it somehow
 possible to do this?

 I tried things like:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true), {variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 Also this way does not work:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: {$('thisform').serialize(true), variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 And this way doesn't work either:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true),
   parameters: {variable1: 'input', variable2: 'otherinput', variable3:
 'somestring'},
   evalScripts: 'true'
   });

 Does anybody have an idea?

 Thanks in advance.

 Benedikt.
--~--~-~--~~~---~--~~
You received 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: Dion Almaer: Why I often prefer Prototype Too

2009-01-23 Thread Yozefff

nice article ..

for me .. I love Prototype as for building classes/objects. Thats for
the programmer in me. For the designer in me, I use YUI. I don't like
jquery as a gui framework, for some reason YUI does it for me.

On Jan 22, 5:44 pm, Diodeus diod...@gmail.com wrote:
 An interesting read:

 http://almaer.com/blog/why-i-often-prefer-prototype-too
--~--~-~--~~~---~--~~
You received 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: Having trouble with .without().

2009-01-23 Thread Richard Quadling

2009/1/22 Matt Foster mattfoste...@gmail.com:

 It appears as though without accepts its values in individual
 parameters.  Looking at the documentation it does illustrate that each
 value is set in as its own parameter.
 http://prototypejs.org/api/array/without

 Looking into the source it becomes clear that it uses the function's
 arguments as array to purge values from, not the first argument as an
 array.
 A snippet from proto 1.6...

 without: function() {
var values = $A(arguments);
return this.select(function(value) {
  return !values.include(value);
});
  },

 I'm pretty sure proto's CSS parser can handle the not pseudo selector,
 so you can do something like this...

 $$(s_CSS + :not(.nonSpacing));

 http://www.w3.org/TR/css3-selectors/#negation


 --

 http://positionabsolute.net





 On Jan 22, 12:27 pm, Richard Quadling rquadl...@googlemail.com
 wrote:
 Hi.

 s_CSS = '.scrollBox  label';
 console.info($$(s_CSS));
 console.info($$(s_CSS + '.nonSpacing'));
 console.info($$(s_CSS).without($$(s_CSS + '.nonSpacing')));

 [label.nonSpacing, label, label.nonSpacing, label, label, label,
 label, label.nonSpacing, label, label, label, label, label.nonSpacing,
 label, label, label, label, label.nonSpacing, label, label, label,
 label, label.nonSpacing, label, label, label, label, label.short,
 label, label, label]

 [label.nonSpacing, label.nonSpacing, label.nonSpacing,
 label.nonSpacing, label.nonSpacing, label.nonSpacing, label.short]

 [label.nonSpacing, label, label.nonSpacing, label, label, label,
 label, label.nonSpacing, label, label, label, label, label.nonSpacing,
 label, label, label, label, label.nonSpacing, label, label, label,
 label, label.nonSpacing, label, label, label, label, label.short,
 label, label, label]

 The first info shows me all the labels in the .scrollBox.
 The second info shows me all the labels in the scrollBox which are 
 nonSpacing.
 The third info shows me the same as the first. The .without is NOT
 working as I would expect.

 Any ideas?

 Richard.

 --
 -
 Richard Quadling
 Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!
 


Job done. Thanks. I'd tried it and got what I thought were answers,
but forgot I was looking at the console. I'd not changed the actual
code. Doh!


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread coruscant

Hi,

thank you for your reply.

I tried to incorporate this in my script which is now looking like
this:

var formhash = $('myform').serialize();

formhash.set('key1', 'value1');
formhash.set('key2', 'value2');
formhash.set('key3', 'value3');

new Ajax.Updater(rettab, '$script', {
  method: 'post',
  parameters: formhash.map,
  evalScripts: 'true'
  });

Anyway I get the return error:
formhash.set is not a function

Can you please tell me what I am doing wrong?

Thanks again,
Benedikt.


On 23 Jan., 10:00, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 Form#serialize[1] returns a Hash object[2] when you call it with
 'true' as the getHash parameter (as you are).  So just do that
 *before* your Ajax.Updater call, and add your further items to the
 Hash, and then pass the Hash into the updater call.

 [1]http://prototypejs.org/api/form/serialize
 [2]http://prototypejs.org/api/hash

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

 On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:

  Hello All,

  I want to use Ajax.updater in one of my PHP scripts. I would like to
  send all the variables of a form to the server, therefore I use the
  form serialize method. Anyway I need to tell the server other
  variables that are not and can not be in the form. Is it somehow
  possible to do this?

  I tried things like:

  new Ajax.Updater('rettab', '$script', {
    method: 'post',
    parameters: $('thisform').serialize(true), {variable1: 'input',
  variable2: 'otherinput', variable3: 'somestring'},
    evalScripts: 'true'
    });

  Also this way does not work:

  new Ajax.Updater('rettab', '$script', {
    method: 'post',
    parameters: {$('thisform').serialize(true), variable1: 'input',
  variable2: 'otherinput', variable3: 'somestring'},
    evalScripts: 'true'
    });

  And this way doesn't work either:

  new Ajax.Updater('rettab', '$script', {
    method: 'post',
    parameters: $('thisform').serialize(true),
    parameters: {variable1: 'input', variable2: 'otherinput', variable3:
  'somestring'},
    evalScripts: 'true'
    });

  Does anybody have an idea?

  Thanks in advance.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread coruscant

Hi,

thanks, this was a silly mistake. I corrected it to:

var formhash = $('myform').serialize(true);

Anyway the error message is still the same:

formhash.set is not a function

I am using prototype 1.6. I also get the error when trying not to do
the Form#serialize thing but rather call a new hash with

var formhash = new hash();

I really have no clue what I should try next.

Best Regards,
Benedikt.



On 23 Jan., 12:44, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You need to pass 'true' to serialize() to get a hash rather than a
 string.  See the Form#serialize docs referenced earlier for details.

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

 On Jan 23, 10:28 am, coruscant ca...@two-wings.net wrote:

  Hi,

  thank you for your reply.

  I tried to incorporate this in my script which is now looking like
  this:

  var formhash = $('myform').serialize();

  formhash.set('key1', 'value1');
  formhash.set('key2', 'value2');
  formhash.set('key3', 'value3');

  new Ajax.Updater(rettab, '$script', {
    method: 'post',
    parameters: formhash.map,
    evalScripts: 'true'
    });

  Anyway I get the return error:
  formhash.set is not a function

  Can you please tell me what I am doing wrong?

  Thanks again,
  Benedikt.

  On 23 Jan., 10:00, T.J. Crowder t...@crowdersoftware.com wrote:

   Hi,

   Form#serialize[1] returns a Hash object[2] when you call it with
   'true' as the getHash parameter (as you are).  So just do that
   *before* your Ajax.Updater call, and add your further items to the
   Hash, and then pass the Hash into the updater call.

   [1]http://prototypejs.org/api/form/serialize
   [2]http://prototypejs.org/api/hash

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

   On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:

Hello All,

I want to use Ajax.updater in one of my PHP scripts. I would like to
send all the variables of a form to the server, therefore I use the
form serialize method. Anyway I need to tell the server other
variables that are not and can not be in the form. Is it somehow
possible to do this?

I tried things like:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: $('thisform').serialize(true), {variable1: 'input',
variable2: 'otherinput', variable3: 'somestring'},
  evalScripts: 'true'
  });

Also this way does not work:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: {$('thisform').serialize(true), variable1: 'input',
variable2: 'otherinput', variable3: 'somestring'},
  evalScripts: 'true'
  });

And this way doesn't work either:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: $('thisform').serialize(true),
  parameters: {variable1: 'input', variable2: 'otherinput', variable3:
'somestring'},
  evalScripts: 'true'
  });

Does anybody have an idea?

Thanks in advance.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread T.J. Crowder

Hi,

Whenever you're faced with this sort of thing, your best bet is to use
a debugger and inspect what you're really getting back, perhaps even
using it to walk through the Prototype code to see what's going on,
read through the Prototype code you're using, etc.  Doing that can be
a very fast way of figuring out what's going on.  Some debugging
resources can be found here:
http://proto-scripty.wikidot.com/resources

In this case, looking at the Prototype code, it looks to me like the
documentation is a bit misleading:  It says serialize will return a
hash, and it does in the lower-case general sense of the word.  It
doesn't return a Hash object.  Sorry about that!

So what you get back is a POJO (plain old JavaScript object), which is
(IMHO) even better, because then you can do this:

var formhash = $('myform').serialize(true);

formhash.key1 = 'value1'; // Or formhash['key1'] = 'value1'; if you
like
formhash.key2 = 'value2';
formhash.key3 = 'value3';

When you're passing the object into the updater, just pass it
directly.

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


On Jan 23, 12:05 pm, coruscant ca...@two-wings.net wrote:
 Hi,

 thanks, this was a silly mistake. I corrected it to:

 var formhash = $('myform').serialize(true);

 Anyway the error message is still the same:

 formhash.set is not a function

 I am using prototype 1.6. I also get the error when trying not to do
 the Form#serialize thing but rather call a new hash with

 var formhash = new hash();

 I really have no clue what I should try next.

 Best Regards,
 Benedikt.

 On 23 Jan., 12:44, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  You need to pass 'true' to serialize() to get a hash rather than a
  string.  See the Form#serialize docs referenced earlier for details.

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

  On Jan 23, 10:28 am, coruscant ca...@two-wings.net wrote:

   Hi,

   thank you for your reply.

   I tried to incorporate this in my script which is now looking like
   this:

   var formhash = $('myform').serialize();

   formhash.set('key1', 'value1');
   formhash.set('key2', 'value2');
   formhash.set('key3', 'value3');

   new Ajax.Updater(rettab, '$script', {
     method: 'post',
     parameters: formhash.map,
     evalScripts: 'true'
     });

   Anyway I get the return error:
   formhash.set is not a function

   Can you please tell me what I am doing wrong?

   Thanks again,
   Benedikt.

   On 23 Jan., 10:00, T.J. Crowder t...@crowdersoftware.com wrote:

Hi,

Form#serialize[1] returns a Hash object[2] when you call it with
'true' as the getHash parameter (as you are).  So just do that
*before* your Ajax.Updater call, and add your further items to the
Hash, and then pass the Hash into the updater call.

[1]http://prototypejs.org/api/form/serialize
[2]http://prototypejs.org/api/hash

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

On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:

 Hello All,

 I want to use Ajax.updater in one of my PHP scripts. I would like to
 send all the variables of a form to the server, therefore I use the
 form serialize method. Anyway I need to tell the server other
 variables that are not and can not be in the form. Is it somehow
 possible to do this?

 I tried things like:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true), {variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 Also this way does not work:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: {$('thisform').serialize(true), variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 And this way doesn't work either:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true),
   parameters: {variable1: 'input', variable2: 'otherinput', variable3:
 'somestring'},
   evalScripts: 'true'
   });

 Does anybody have an idea?

 Thanks in advance.

 Benedikt.


--~--~-~--~~~---~--~~
You received 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] Question from an almost ajax newbbie

2009-01-23 Thread david.0pl...@gmail.com

First of all I'm David, from Italy.
I recently started looking into your fabolous prototype thanks to this
script: http://tetlaw.id.au/view/javascript/really-easy-field-validation

After some playing around I decided to add another validation check.
Without going into the details of the other script (which is not
relevent) I would like to ask you how can I return a variable AFTER an
Ajax request has finished.

This is the code:

function(v) {
new Ajax.Request('availability.php',
{method: 'get', parameters: {validate: v},
onSuccess: function( transport ) {
 if( transport.responseText.match(/true/)) {
risultato = false;
}
else {
risultato = true;
}
}
});
return risultato;
}

The problem is that availability takes a long time to process the
response (1sec) and while he process the thing risultato has the value
of the last query.

For example: first time we have risultato = true;
so it returns: true
The second time I invoke the function i still have risultato = true
from before. Now the ajx request returns risultato = false BUT while
it goes the functions returns true.

How can I avoid this?

Thank you very much

--~--~-~--~~~---~--~~
You received 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: Question from an almost ajax newbbie

2009-01-23 Thread T.J. Crowder

Ciao David,

By default, Ajax requests are asynchronous, and so they get *started*
when you do new Ajax.Requst but then they run for a while and
complete later; meanwhile, your code that started the request
continues.  So what your anonymous function above returns will be
whatever value risultato has when the function starts, since the
request hasn't completed yet.  Later, at a time you cannot predict,
the value of risultato will be updated by the callbacks you've
registered.

You _can_ make requests synchronous if you like (set the asynchronous
parameter to false), but that will lock up the UI of the browser for
the entire time the request is taking pace -- which from what you've
said about availability.php non sembra una buona idea.

This might be useful:
http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests
It's an example of an Ajax request that starts the process of
retriving a record from the server, and then displays that record (or,
of course, an error) on callback.

Basically, when working with lots of asynchronous stuff like this, you
end up modifying your logic so you don't make a function call and
expect an answer back, but instead you make a function call and expect
to handle the result in callbacks.

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


On Jan 23, 12:38 pm, david.0pl...@gmail.com david.0pl...@gmail.com
wrote:
 First of all I'm David, from Italy.
 I recently started looking into your fabolous prototype thanks to this
 script:http://tetlaw.id.au/view/javascript/really-easy-field-validation

 After some playing around I decided to add another validation check.
 Without going into the details of the other script (which is not
 relevent) I would like to ask you how can I return a variable AFTER an
 Ajax request has finished.

 This is the code:

 function(v) {
                 new Ajax.Request('availability.php',
                 {method: 'get', parameters: {validate: v},
                 onSuccess: function( transport ) {
                      if( transport.responseText.match(/true/)) {
                         risultato = false;
                         }
                 else {
                 risultato = true;
                 }
                 }
                 });
                 return risultato;
                 }

 The problem is that availability takes a long time to process the
 response (1sec) and while he process the thing risultato has the value
 of the last query.

 For example: first time we have risultato = true;
 so it returns: true
 The second time I invoke the function i still have risultato = true
 from before. Now the ajx request returns risultato = false BUT while
 it goes the functions returns true.

 How can I avoid this?

 Thank you very much
--~--~-~--~~~---~--~~
You received 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] Div's opacity gets lower and stucked

2009-01-23 Thread Anushka

hi

im using scriptaculous-js-1.8.1 package for my project. in my project
i have a div that contains a html table. i have to move this div on
the page. so i use script scriptaculous lib. i can move the div easily
but the problem is when i move the div some times its opacity gets low
and stuck in that view. that means some times half of the div is not
visible.

can you help me to find out a solution.

Regards,
Anushka

--~--~-~--~~~---~--~~
You received 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] Adding methods to Elements of a certain class.

2009-01-23 Thread Richard Quadling

Hi.

Should I add the method using (A)...

$$('.css').invoke('addMethod', function(el, args){
  // Payload
});

Or should I use (B) ...

Element.addMethods(function(el, args) {
  if (el.hasClass('css')) {
// Payload
  }
});
Element.addMethods();


Using (A) directly attaches to any current elements, but (B) will work
on existing and new elements.

I suppose, based upon my own assumptions above, (B) would be the way to go.

Unless there is a way to attach behaviour based upon style (so attach
the method to the style which is then applied to the element when the
style is).

Regards,

Richard Quadling.
-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

--~--~-~--~~~---~--~~
You received 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: Question from an almost ajax newbbie

2009-01-23 Thread david.0pl...@gmail.com

I get an hint that we are 'compaesani' :-P

Anyhow.. thank you very much,I'm studying that link you gave me,
meanwhile, in my particular case setting to syncronous has indeed
resolved my issue.

Thank you very much for you toughtfull response


A presto

David(e)

On Jan 23, 2:08 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Ciao David,

 By default, Ajax requests are asynchronous, and so they get *started*
 when you do new Ajax.Requst but then they run for a while and
 complete later; meanwhile, your code that started the request
 continues.  So what your anonymous function above returns will be
 whatever value risultato has when the function starts, since the
 request hasn't completed yet.  Later, at a time you cannot predict,
 the value of risultato will be updated by the callbacks you've
 registered.

 You _can_ make requests synchronous if you like (set the asynchronous
 parameter to false), but that will lock up the UI of the browser for
 the entire time the request is taking pace -- which from what you've
 said about availability.php non sembra una buona idea.

 This might be 
 useful:http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-re...
 It's an example of an Ajax request that starts the process of
 retriving a record from the server, and then displays that record (or,
 of course, an error) on callback.

 Basically, when working with lots of asynchronous stuff like this, you
 end up modifying your logic so you don't make a function call and
 expect an answer back, but instead you make a function call and expect
 to handle the result in callbacks.

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

 On Jan 23, 12:38 pm, david.0pl...@gmail.com david.0pl...@gmail.com
 wrote:

  First of all I'm David, from Italy.
  I recently started looking into your fabolous prototype thanks to this
  script:http://tetlaw.id.au/view/javascript/really-easy-field-validation

  After some playing around I decided to add another validation check.
  Without going into the details of the other script (which is not
  relevent) I would like to ask you how can I return a variable AFTER an
  Ajax request has finished.

  This is the code:

  function(v) {
                  new Ajax.Request('availability.php',
                  {method: 'get', parameters: {validate: v},
                  onSuccess: function( transport ) {
                       if( transport.responseText.match(/true/)) {
                          risultato = false;
                          }
                  else {
                  risultato = true;
                  }
                  }
                  });
                  return risultato;
                  }

  The problem is that availability takes a long time to process the
  response (1sec) and while he process the thing risultato has the value
  of the last query.

  For example: first time we have risultato = true;
  so it returns: true
  The second time I invoke the function i still have risultato = true
  from before. Now the ajx request returns risultato = false BUT while
  it goes the functions returns true.

  How can I avoid this?

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



[Proto-Scripty] Re: help with autocompleter

2009-01-23 Thread eulerss

Thanks Colin, i'm reading the link, if i continue with problems, i'll
post here

eulerss

On 23 ene, 04:34, ColinFine colin.f...@pace.com wrote:
 On Jan 22, 11:18 pm, eulerss eulers...@hotmail.com wrote: please help, i 
 was seeing one example but i have some doubts

  1) in the principal file

  script src=lib/prototype.js type=text/javascript/script
  script src=src/scriptaculous.js type=text/javascript/script
  script src=src/unittest.js type=text/javascript/script

  its necessary to add the unittest.js?? (sorry i repeated, im noob in
  this)

 No. I've never included it.

  2) if i used, for instance response.php in order to get all values,
  whats the correct form?
  i mean, can i used response.php simple like this

  ?php
  echo div
  ul
  liA/li
  liB/li
  ul
  /div;
  ?

 Don't send the div, just the ul  [1]



  3)whats the form when i'm calling the funcion ajax.autocompleter?

  script type=text/javascript language=javascript

                  new Ajax.Autocompleter('id','id','response.php');

 No, you need to supply two different elements (or id's) - first the
 input field, and then the div in which it is to put the list.
 Please read [1] carefully.

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

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



[Proto-Scripty] Re: Adding methods to Elements of a certain class.

2009-01-23 Thread Richard Quadling

2009/1/23 Richard Quadling rquadl...@googlemail.com:
 Hi.

 Should I add the method using (A)...

 $$('.css').invoke('addMethod', function(el, args){
  // Payload
 });

 Or should I use (B) ...

 Element.addMethods(function(el, args) {
  if (el.hasClass('css')) {
// Payload
  }
 });
 Element.addMethods();


 Using (A) directly attaches to any current elements, but (B) will work
 on existing and new elements.

 I suppose, based upon my own assumptions above, (B) would be the way to go.

 Unless there is a way to attach behaviour based upon style (so attach
 the method to the style which is then applied to the element when the
 style is).

 Regards,

 Richard Quadling.
 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!


This works ...

$$('.tabC').each(   function(el){
el.addSheet = addSheet.methodize();
});

but this doesn't ...

$$('.tabC').invoke('writeAttribute', 'addSheet', addSheet.methodize());

Should it?


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[Proto-Scripty] Re: help with autocompleter

2009-01-23 Thread eulerss

i have a problem :( this is my error:

Stack overflow at line 1926

this error appears when i load for fist time the page,for example, if
i type P, appears, but then, not any more, and the most important
thing is that my autocomplete function is not working, here is my
simple code that i take from the link that ColinFine gave me:

html
head
meta http-equiv=Content-Type content=text/html;
charset=windows-1252
title/title

script type=text/javascript src=js/prototype.js/script

script type=text/javascript src=js/scriptaculous.js/script

body

input type=text id=autocomplete 
name=autocomplete_parameter/

div id=autocomplete_choices/div

script type=text/javascript
new Ajax.Autocompleter(autocomplete, 
autocomplete_choices, ./
li.php, {});
/script

/body
/head
/html

i think that my code is correct, i have two id's, one of the input and
other of the div element, and in the Ajax.Autocompleter i'm using this
id's, and my file li.php that contains my list, this is the simple
code of mi li.php file:

?php
echo ul
   liPerkins Justin/li
   liPerkins Tim/li
   liPopulate/li
   liPersons/li
   liPeople/li
   liPost/li
/ul;

?

any ideas?

thanks in advance

eulerss


On 23 ene, 09:26, eulerss eulers...@hotmail.com wrote:
 Thanks Colin, i'm reading the link, if i continue with problems, i'll
 post here

 eulerss

 On 23 ene, 04:34, ColinFine colin.f...@pace.com wrote:



  On Jan 22, 11:18 pm, eulerss eulers...@hotmail.com wrote: please help, i 
  was seeing one example but i have some doubts

   1) in the principal file

   script src=lib/prototype.js type=text/javascript/script
   script src=src/scriptaculous.js type=text/javascript/script
   script src=src/unittest.js type=text/javascript/script

   its necessary to add the unittest.js?? (sorry i repeated, im noob in
   this)

  No. I've never included it.

   2) if i used, for instance response.php in order to get all values,
   whats the correct form?
   i mean, can i used response.php simple like this

   ?php
   echo div
   ul
   liA/li
   liB/li
   ul
   /div;
   ?

  Don't send the div, just the ul  [1]

   3)whats the form when i'm calling the funcion ajax.autocompleter?

   script type=text/javascript language=javascript

                   new Ajax.Autocompleter('id','id','response.php');

  No, you need to supply two different elements (or id's) - first the
  input field, and then the div in which it is to put the list.
  Please read [1] carefully.

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

  Colin- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
You received 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: Modifying prototypescriptaculous to work alongside jQuery

2009-01-23 Thread kangax

On Jan 23, 10:11 am, Jan Hansen j...@nhl-data.dk wrote:
 I've been in the same problematic situation as well. However, we managed
 to use jQuerys noConflict mode in the 3'rd part component so that was
 great - but two questions:

 1)
 Would it be possible to implement a noConflict mode in prototype? (why
 isn't there one already?)

Because the actual philosophy of prototype.js goes somewhat against
such mode. There are quite few native and host objects being
augmented. There are also quite few global properties being created/
modified. Eliminating all of that would take a good portion of what
prototype.js is all about. Such thing is also impossible to accomplish
without breaking backwards compatibility. There are plans to change
current approach in next major (backwards-incompatible) release but
it's not clear when it will be done and how it will be done.


 2)
 Why use the $ per default? is it by nature of some javascript thing
 I havent realized - or is it just by convention, aka could it have
 been P or £ just as well?

`$` is just one of the characters allowed to be part of (and a first
character) of `Identifier` (in other words, variable name) as per
ECMAScript specs. Back in the days when libraries picked it up, it
was probably due to the fact that it looked distinguishable enough and
short enough for such frequently-used functionality (querying element
by id and/or extending element)

[...]

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



[Proto-Scripty] Re: Adding methods to Elements of a certain class.

2009-01-23 Thread kangax

On Jan 23, 10:29 am, Richard Quadling rquadl...@googlemail.com
wrote:
 2009/1/23 Richard Quadling rquadl...@googlemail.com:

[...]

 This works ...

 $$('.tabC').each(       function(el)    {
         el.addSheet = addSheet.methodize();

 });

I wouldn't suggest doing this. You are burdening all of those elements
with a methodized function instead of putting that function
(once!) and *sharing* it on `Element.prototype` or
`HTMLElement.prototype` or `HTMLDivElement.prototype` or whatever it
would end up on when using prototype's `Element.addMethods`. Granted,
you have no choice but to extend each element in IE which doesn't
support element extensions, but why cripple normal browsers? : )

Is it really necessary to have such precise control of which methods
end up on which elements? If the elements you want to extend are of
the same type, then extend just that type; If not - extend elements
generically and check for `className` explicitly. This will save you
tons of memory and remove chances of leaks in IE:

Element.addMethods({
  foo: function(el, ...) {
...
if (el.hasClassName('bar')) { bar(); }
else { baz(); }
...
  }
});
...

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



[Proto-Scripty] Re: Modifying prototypescriptaculous to work alongside jQuery

2009-01-23 Thread kangax

On Jan 23, 3:00 pm, Gabriel Gilini gabr...@usosim.com.br wrote:
 Quoting the Ecma-262:

 This standard specifies one departure from the grammar given in the Unicode
 standard: The dollar sign ($)
 and the underscore (_) are permitted anywhere in an identifier. The dollar
 sign is intended for use only in
 mechanically generated code.

Thank god they removed the last sentence from ES3.1 (as of current
draft)

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



[Proto-Scripty] Re: Modifying prototypescriptaculous to work alongside jQuery

2009-01-23 Thread Hector Virgen
Wow, so only robot programmers can write a $() function?

-Hector


On Fri, Jan 23, 2009 at 12:16 PM, kangax kan...@gmail.com wrote:


 On Jan 23, 3:00 pm, Gabriel Gilini gabr...@usosim.com.br wrote:
  Quoting the Ecma-262:
 
  This standard specifies one departure from the grammar given in the
 Unicode
  standard: The dollar sign ($)
  and the underscore (_) are permitted anywhere in an identifier. The
 dollar
  sign is intended for use only in
  mechanically generated code.

 Thank god they removed the last sentence from ES3.1 (as of current
 draft)

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



[Proto-Scripty] Re: How to read draggables position?

2009-01-23 Thread antonio.grazi...@gmail.com

I have declared a New Draggable called 'module_left' in a script in
my HTML page

should I add your code in the HTML page or in the .js file ?
--~--~-~--~~~---~--~~
You received 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] Soft content DIV updating

2009-01-23 Thread jay

Hi,

This is my first post and I am a designer not a developer. I am
working on a site where I want the new content to load into the main
and sub DIVs as defined in the CSS dynamically (thereby not reloading
the Flash content on the page, consisting of a global graphic header
and a seperate MP3 player).

I was onto exactly what I needed with jQuery:

http://nettuts.s3.amazonaws.com/011_jQuerySite/sample/index.html

Unfortunately, as I dug deeper, I realized it wrecks SEO and destroys
the browser back button and bookmarking AND Google analytics

I have looked through the Scriptaculous site and cannot find a similar
script - can anybody help or am I on the wrong track?

Thanks,
Jay

--~--~-~--~~~---~--~~
You received 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] Cloning an HTML Element

2009-01-23 Thread da644

Hi,

I have an HTML object that has been creating using some scripting and
I wish to insert this into to different locations on the page, e.g.

var newObj = createMyObject();
$('location1').insert(newObj);
$('location2').insert(newObj);

However doing this the object get inserted into location1 and then
removed from location1 when it is inserted into location2. I have
tried using the clone method:

var newObj = createMyObject();
var newObj2 = Object.clone(newObj);
$('location1').insert(newObj);
$('location2').insert(newObj2);

However this doesn't work. It doesn't error, but it simply stops
anymore Javascript from executing.

Is there a way to do what I want using Prototype?

Kind regards,

Andrew.

--~--~-~--~~~---~--~~
You received 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: Cloning an HTML Element

2009-01-23 Thread RobG



On Jan 24, 6:57 am, da644 andrewjdi...@gmail.com wrote:
 Hi,

 I have an HTML object that has been creating using some scripting and
 I wish to insert this into to different locations on the page, e.g.

 var newObj = createMyObject();
 $('location1').insert(newObj);
 $('location2').insert(newObj);

 However doing this the object get inserted into location1 and then
 removed from location1 when it is inserted into location2.

Which is exactly how it is supposed to work.  :-)


 I have
 tried using the clone method:

 var newObj = createMyObject();
 var newObj2 = Object.clone(newObj);

That is for cloning (more like copying) a native javascript object.
What you are trying to do is clone a host object.

 $('location1').insert(newObj);
 $('location2').insert(newObj2);

 However this doesn't work. It doesn't error, but it simply stops
 anymore Javascript from executing.

 Is there a way to do what I want using Prototype?

If your object is an HTML element that implements the DOM Core
interface Node (and most of them do), use its cloneNode method:

  $('location1').insert(newObj.cloneNode(true));

It is called cloneNode to ensure it is obvious that its purpose is
to clone Nodes, not other types of objects.  Be aware however that it
will clone all of the element's properties, including ones like ID
that should be unique in the document.

Also, listeners may or may not be cloned depending on how they were
added and which browser the code is run in.


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