[Proto-Scripty] Firefox height:100% bug w/ prototype fix

2010-11-15 Thread Scott
So I've been working on a project the involves a table cell being
scrollable. Firefox is not too friendly with height:100% when the
parent element does not have a fixed height. (basically height:100% of
height:auto = height:auto). From what I hear (and I don't want to
start a standards compliance debate) firefox is following the rules
but I'm not happy with it. IE, Chrome and Safari are rendering the
desired results, I could care less who is doing it 'right'.

This is more of a css issue but I'm pasting it here because I used the
prototype library to aid me in my solution.

http://pastie.org/1300351

let me know what you think or if you have any suggestions to improve
my code.
(please exclude your opinions on standards compliance)

- Scott

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



[Proto-Scripty] Re: Scalable Drag Drop (without noticeable lag)

2010-11-15 Thread Scott
Eric,

Awesome suggestion thank you! I am now only observing the containers
and deciding what to do based on the event.findElement().

as far as the drag/drop goes, I am actually doing my own version. on
mousedown of the container, I am cloning the element returned by
event.findElement() and attaching it to the cursor (slightly offset so
that the cursor is not over the top of the clone) and then on mouseup
finding the new element and grabbing the info I need to complete the
'drop'.

same goes with observing click: I am only observing click on the
container.

Thanks again!


On Oct 19, 1:02 am, Eric lefauv...@gmail.com wrote:
 Hi Scott,

 I didn't do much with drag/drop using scripty, but can't you just have
 one droppable (in your case it would be $('cats')) and find out which
 span was under the mouse when a drop occurs?

 In the same spirit, instead of adding a onmouseover event on
 each .drag item, you may add one on your body (or on your two ULs if
 you prefer), and test if the event happened on one .drag element
 (something like if(elt=event.findElement('.drag')) ...).

 Last point: I don't know if it is possible, but did you try to create
 the draggable on the mousedown instead of the mouseover?
 It will save lots of work to the browser (It would require some
 tweaks, but I successfully used this technique with
 Ajax.InPlaceEditor).

 Eric

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



[Proto-Scripty] Re: Scalable Drag Drop (without noticeable lag)

2010-10-18 Thread Scott
 What I usually do is post it inline in the message (as you did), and
 *also* post it to Pastie.org and provide a link.

Thanks T.J.

Here's a url to my test code:
http://pastie.org/1230063

Anyone got any ideas / suggestions (/improvements on my code)?

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



[Proto-Scripty] Re: Scalable Drag Drop (without noticeable lag)

2010-10-15 Thread Scott
When copying and pasting the html from my post, there are some extra
line breaks or wrapping happening. Not much I can do about that i
guess. just letting you know I didn't write it that way.

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



Re: [Proto-Scripty] Re: form input not working

2010-09-11 Thread Scott Pickles
Nigel -

Your second command to insert new begins with $('messageLbl').  Shouldn't
that begin with $(scoreForm') since you're trying to add a new input element
of type 'text'?

Regards,
Scott

On Sep 11, 2010 7:12 AM, nigeke...@googlemail.com 
nigeke...@googlemail.com wrote:

Blaine - Thanks for responding.

Exactly. When I type the text into the field it does not appear. I can
focus it but I cannot type into it.

The browser I'm using is Safari 5.0.1.

Copy and pasting the source doesn't help. I use the index page only to
load up the js libraries and some css. I have simplified the code down
so that I can give a simple presentation of the issue. I am just
extract code into a seperate application and see if this gives a good
result.

Basically this is part of a stand alone game developed with phonegap
to run on webOS, iOS and android.

I am currently introducing some networking capability for a score
leaderboard.

I can post to my rails server controller/model if I hard code the
input element values. I can also get data. I do not use the rails
views.

I guess you do not see something obvious in the code below. That's all
I wanted to check. Was I doing something stupid because I am new to
forms.

Looking at Web Inspector I notice that the contentEditable property is
set to false for the input elements. Should this be true?

I'll take on board your advice.

Nigel



On Sep 10, 7:38 pm, Blaine blaine.simp...@admc.com wrote:
 When you say input does not work, ...

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



[Proto-Scripty] Re: Scriptaculous and !--include virtual=xxx.html--

2010-06-21 Thread Scott
is your html file in a virtual directory? also this include tag will
only work if your page is being hosted on an asp server or your local
windows machine as a website through IIS

On Jun 19, 6:56 am, Avram abas...@mitre.org wrote:
 I tried including the Scriptaculous code in an external html file and
 call it with a !--include virtual=xxx.html--?  This didn't work,
 Should it work?  Is there another way to call Scriptaculous code from
 an an external file using HTML and CSS?

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



[Proto-Scripty] RE: returning a value from a function calling a page with Ajax

2010-06-03 Thread Scott
In case this replay didn't end up in the appropriate thread:

http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/
db829a1d3ca58d79

 

REPLY:

 

So here is my simple test using your method:

 

I had to change the 'onSuccess' method in the updater to 'onComplete'

it wasn't working for some reason. I don't remember if 'onSuccess' is

after the DOM is loaded or not.

 

html

   head

   titleSimple callback test/title

   script type=text/javascript
src=/js/protoaculous.1.8.2.min.js/script

   script type=text/javascript

   function userChooser(callback) {

   $('readout').insert({ bottom: 'loading callback.vb.asp...br
/' });

   new Ajax.Updater('divID', 'callback.vb.asp', {

   onComplete: function() {

   updateSuccess();

   $('readout').insert({ bottom: 'loading success!br
/' });

   }

   });

 

   function updateSuccess() {

   $('divID').down(input[name=btnChoose]).observe('click',
chosenClick);

   $('readout').insert({ bottom: 'observing button...br /'
});

   }

 

   function chosenClick(event) {

   var theDiv;

   event.stop();

   $('readout').insert({ bottom: 'event stopped...br /'
});

   theDiv = $('divID');

   theDiv.stopObserving('click', chosenClick);

   $('readout').insert({ bottom: 'observing stopped...br
/' });

callback(theDiv.down('select[name=choices]').getValue());

   }

   }

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

   userChooser(choiceMade);

   function choiceMade(choice) {

   $('readout').insert({ bottom: choice + 'br /' });

   }

   });

   /script

   style type=text/css

   body{margin:0px;padding:0px;}

   #divID{border:solid 1px #000;width:400px;}

   #readout{font:normal 8pt Arial;width:400px;}

   /style

   /head

   body

   div id=divID/div

   div id=readout/div

   /body

/html

 

 

and callback.vb.asp:

 

select name=choices

   option value=1Bob/option

   option value=2Dave/option

   option value=3Joe/option

   option value=4Mick/option

/selectbr /

input type=button name=btnChoose value=Choose User /

 

 

It works perfectly. As long as I disable any other user input until

they have chosen a user, this should work out great.

 

Again sorry for the long wait for my response. Your work is much

appreciated!

 

Thank you!

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



[Proto-Scripty] Sortable issue in IE

2010-04-21 Thread Scott
I have a page with thumbnail images that need to be sortable.

In all browsers but IE this works great. In IE when i drag an item,
the items do not shift to allow dropping. If I remove float:left; from
the css it works but then my divs are not inline. (if i set
display:inline; my divs will not keep their margin)

I know there is a better way to do this. I just haven't figured it
out.

Here is my code:

style type=text/css
.photoBox{
background:#fff;
border:solid 1px #d8dfea;
float:left;
height:150px;
margin:10px;
text-align:center;
width:150px;
}
/style

div id=container
  div id=box_1 class=photoBox[img]/div
  div id=box_2 class=photoBox[img]/div
  div id=box_3 class=photoBox[img]/div
/div

script type=text/javascript
Event.observe(window, 'load', function() {
Sortable.create('container', {
tag: 'div', overlap: 'horizontal', constraint: false,
starteffect: function() {
},
endeffect: function() {
}
});
});
/script

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



[Proto-Scripty] returning a value from a function calling a page with Ajax

2010-03-29 Thread Scott
I am trying to build a function that will return a value based on user
input on a page loaded into a div using Ajax.Updater.

So for example:

function userChooser() {
  new Ajax.Updater('divID', 'userChooser.asp');
}

alert(userChooser());

Inside userChooser.asp I would display a list that the user can click
on. When they click on an item in the list, I want the function to
return that item. What i don't know is if I can make the function wait
to return until the user clicks on an item (like an alert or confirm
dialog would do). Also if there is a way to make it wait, I don't know
how to assign a value back to that function.

Is this possible?

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



[Proto-Scripty] Re: how to update HTML with Ajax.Request

2010-03-18 Thread Scott
is (rating) being set somewhere or is that the id of the element? if
it is the id then you will need to put single quotes around it
('rating')

If you are using prototype/scriptaculous $('rating') is a shortcut of
document.getElementById('rating')
Also another shortcut is calling update on the element instead of
setting the innerHTML.

$('rating').update('Thanks for rating this quiz');



On Mar 18, 1:26 pm, Zahid m.zahidans...@gmail.com wrote:
 Hi I am trying to use this code to update element in html but it
 does'nt seems to work...please help me out:

 function addToFavorite(quizSeq)
 {
  new Ajax.Request('/my/user-quizzes/processRequest',
     {
       method:'get',
       parameters: { action:'addtofavorite', quiz_seq:quizSeq},
       onSuccess: function(transport){
       var response = transport.responseText || no response text;
      document.getElementById(rating).innerHTML = Thanks for rating
 this quiz;
           },
       onFailure: function(){
       alert(Failed);
           }
     });



 }

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



[Proto-Scripty] Re: Ajax.Request - can't get to work in Firefox, Chrome

2010-03-15 Thread Scott
I have had similar issues before in my applications. I have always
assumes that they were caching issues. With the method as 'post' and
adding the current date and time in the parameters field (or query
string), I've been able to get past this issue.
This is to make sure the url being called is alway unique. You may
want to parse out punctuation characters though.

I would be interested to know if this is some sort of application
scope issue like T.J. Crowder is suggesting. It seems unlikely due to
the fact that IE is allowing it. Although I have seen IE do some
pretty weird stuff I wouldn't ignore the possibility.


On Mar 12, 6:53 am, Ronen rrotst...@gmail.com wrote:
 I've downloaded the latest prototype (version 1.6.1) and tried to call
 a java servlet using Ajax.Request.  From IE, it works just fine
 (probably because it's using ActiveX rather than XMLHttpRequest), but
 I'm having no luck with Firefox (v3.6) and Chrome (4.0).

 The servlet that I'm calling performs a log operation right away so I
 can see whether it was called or not.  That's how I know that IE is
 successful but firefox and chrome aren't.

 I've used Firebug to try to debug firefox and I see that the line
 this.transport.send(this.body);
 is, in fact, being called by firefox.  But still, my servlet shows no
 log of being called.

 The exact javascript I'm using is below:
      var opts = {
           method: 'post',
           parameters : { key:value },
           onSuccess: function(transport)
           {
                var d = new Date();
                document.getElementById(location).value =
 d.getTime();
           }
      }
      var asyncReq = new Ajax.Request(http://localhost:8701/MyApp/
 MyServlet, opts);

 As you can see, in the success method, I just populate a textbox to
 have the current date/time, and this actually works in all browsers
 (IE, Firefox, Chrome).  Just that in Firefox and Chrome the servlet is
 not physically being called (yet the success method is).

 Any help in solving this issue is greatly appreciated.

 --Ronen

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



[Proto-Scripty] Re: Request object

2010-03-08 Thread Scott
You can write the response to the JSP page and in the form page use
the onComplete event to return the response text

$('myFormID').request({ method: 'post',
  onComplete: function(request) {
alert(request.responseText);
  }
});

so anything written in the JSP page (including html) will come back in
the responseText.


On Mar 8, 11:21 am, samson sbeke...@gmail.com wrote:
 I use the prototype request() function to sumbit my form to a JSP
 page. It work fine and I am able to save the data to the database. But
 I need to return a message to the form page if the JSP page
 successfully save the data. Here is an example

 I have a page called person.jsp and all the form field in this page.
 When a user click on save button I use the prototype request function
 and send the form variable to save.jsp page with out sumbitting the
 form. But I want to return a message to person.jsp if there is success
 or failer on save.jsp page.

 Thanks,
 Samson

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



[Proto-Scripty] Re: Having Effect.Opacity work with a Class and not an ID

2010-03-03 Thread Scott
This is how I'd do it. There might be an easier way also.
var elements = $$('fade-in');
elements.each( function(element) {
  element.appear({ duration: 1.5 });
});

On Mar 3, 9:27 am, CaptainNoob jacobl...@gmail.com wrote:
 ul id=menu
         li id=nav_home class=fade-ina href=/Home/a/li
         li id=nav_archivesa href=/archivesArchives/a/li
         li id=nav_contact class=fade-ina href=/contactContact Me/
 a/li
         li id=nav_googlea href=http://google.com;
 rel=externalGoogle/a/li
 /ul

 --

 new Effect.Opacity('fade-in', { from: 0, to: 1, duration: 1.5 });

 Is it possible to fire scriptaculous effects with a class name rather
 than an ID? I tried putting $$('fade-in') , but that did not seem to
 work.

 Thank you for the help.
 Jacob

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



[Proto-Scripty] Re: how to pass question marks in fields using ajax updater

2010-01-27 Thread Scott
It looks like you are forming your parameters as you would a
querystring
ex: a=appleb=banana

parameters for an Ajax.Updater or Request are usually set up like
this:
parameters: { a: 'apple', b: 'banana' }

if you are still having trouble passing in a '?' you could also try
changing the method to 'post'



On Jan 27, 12:02 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You're doing a lot more work there than you need to (and apparently
 introducing some problem with a question mark; I'm not immediately
 seeing why, but I think your message was truncated).

 Check out Form#serialize and Form.Element#serialize. There's no
 problem submitting fields with question marks.

 http://api.prototypejs.org/dom/form.html#serialize-class_methodhttp://api.prototypejs.org/dom/form.html#serializeelements-class_methodhttp://api.prototypejs.org/dom/form/element.html#serialize-class_method

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

 On Jan 26, 10:01 pm, Tami t...@asktami.com wrote:



  I'm trying to do this (see below) and IF a field has a question mark
  in it then nothing is passed - an EMPTY field is submitted.

  How do I let users enter question marks in the fields on my nested
  form?   Fields are member_nm, member_address, etc.

  Thanks in advance.

  function ajax_Add_famMbr() {

  // alert('member_nm = ' + document.getElementById('member_nm').value +
  ' member_address = ' + document.getElementById('member_address').value
  + ' member_ph = '  + document.getElementById('member_ph').value  + '
  member_email = ' + document.getElementById('member_email').value + '
  date_member_birth = ' + document.getElementById
  ('date_member_birth').value +  ' member_sex = ' +
  document.getElementById('member_sex').value + ' member_ethnicity = '
  +  document.getElementById('member_ethnicity').value + ' btn = ' +
  document.getElementById('AddBtn_famMbr').value) ;

    if (document.getElementById('member_nm').value  == ''){
    alert('Member name is required.');
                          return false;
     }

           var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm';
           var pars = 'a='+document.getElementById('member_nm').value +
  'b='+escape($F('member_address'))  + 'c='+escape($F('member_ph'))  +
  'd='+escape($F('member_email')) + 'e='+escape($F
  ('date_member_birth'))  + 'f='+escape($F('member_sex'))  +
  'g='+escape($F('member_ethnicity')) + 'btn=' +
  document.getElementById('AddBtn_famMbr').value;
           var target = 'ajax_famMbr_div';
           var myAjax = new Ajax.Updater(target, url, {method:'get',
  parameters:pars});
           // reset add form
           document.famMbr.member_nm.value='';
           document.famMbr.member_address.value='';
           document.famMbr.member_ph.value='';
           document.famMbr.member_email.value='';
           document.famMbr.date_member_birth.value='';
           document.famMbr.member_sex.value='';
           document.famMbr.member_ethni

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



[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-12 Thread Scott
my bad. I misunderstood your question. Ignore my response

On Jan 11, 4:16 pm, Scott counterstre...@gmail.com wrote:
 you could submit the entire form using request.

 $(formid).request({ method: 'post',
   onComplete:function(request){
     alert(request.responseText);
   }

 });

 On Jan 11, 12:11 am, Hussein B hubaghd...@gmail.com wrote:



  Hey,
  I have a checkbox in front of each row in my table.
  Upon clicking on submit button, I want to collect the checked boxes
  and send values via Ajax request.
  How to iterate over the checked boxes?
  Thanks for help and time.
-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread Scott
you could submit the entire form using request.

$(formid).request({ method: 'post',
  onComplete:function(request){
alert(request.responseText);
  }
});

On Jan 11, 12:11 am, Hussein B hubaghd...@gmail.com wrote:
 Hey,
 I have a checkbox in front of each row in my table.
 Upon clicking on submit button, I want to collect the checked boxes
 and send values via Ajax request.
 How to iterate over the checked boxes?
 Thanks for help and time.
-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: complete handler for effects.js

2009-08-27 Thread Scott Haines

Just found that bug. Didn't know about afterFinish, is that
automatically added within effects.js. I didn't have that function in
my version of effects.js, would have saved me a bunch of time!

- Scott

On Aug 26, 1:16 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 You have put a trailing comma on the last option wich will cause an error in
 IE !!!...

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Scott Haines sc...@newfrontproductions.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, August 26, 2009 2:36 AM
 Subject: [Proto-Scripty] complete handler for effects.js

  In case anyone has run into the need to have an onComplete style
  handler for effects.js I have made a successful addition to the source
  code.

  Step 1:
  In the main effect.js code skip to about line 100, it should look like
  this:

  DefaultOptions: {
     duration:   1.0,   // seconds
     fps:        100,   // 100= assume 66fps max.
     sync:       false, // true for combining
     from:       0.0,
     to:         1.0,
     delay:      0.0,
     queue:      'parallel',
     complete:   0,
   },

  You are adding 'complete: 0,' to the defaults, this will allow you to
  run a subsequent function once the effect has completed. (This is the
  first step of three).

  Step 2:
  Register the function within the Effect you would like to extend the
  onComplete handler to. I needed this for the Effect.Fade and
  Effect.Appear functions.

  Example: Effect.Fade (starts around line 535)

  Effect.Fade = function(element) {
   element = $(element);
   var oldOpacity = element.getInlineOpacity();
   var options = Object.extend({
     from: element.getOpacity() || 1.0,
     to:   0.0,
     afterFinishInternal: function(effect) {
          if(effect.options.complete != 0){
       effect.options.complete();
          }
       if (effect.options.to!=0) return;
       effect.element.hide().setStyle({opacity: oldOpacity});
     }
   }, arguments[1] || { });
   return new Effect.Opacity(element,options);
  };

  *on the afterFinishInternal you know that the effect has finished, so
  you then ask whether or not the option for complete (onComplete) was
  issued and piped into the function, if so you allow Javascript to read
  the string as a function and you are golden.

  Step 3: Using the onComplete (complete) option in your code.

  example:
  function fadeObj(obj,func){
  Effect.Fade($(obj),{duration:1,complete:func});
  }

  function setInStone(){
  alert('onComplete handler working for effects.js');
  }

  usage:
  fadeObj('fadediv',setInStone);

  I hope this helps anyone else who ran into the same issue. I wanted to
  simulate the functionality of the caurina Tweener methods from
  actionscript 3, or the complete handler from the SPRY lib in the more
  useful effect.js.

  Cheers,
  Scott Haines
  Newfront Creative
 http://www.newfrontcreative.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] complete handler for effects.js

2009-08-26 Thread Scott Haines

In case anyone has run into the need to have an onComplete style
handler for effects.js I have made a successful addition to the source
code.

Step 1:
In the main effect.js code skip to about line 100, it should look like
this:

DefaultOptions: {
duration:   1.0,   // seconds
fps:100,   // 100= assume 66fps max.
sync:   false, // true for combining
from:   0.0,
to: 1.0,
delay:  0.0,
queue:  'parallel',
complete:   0,
  },

You are adding 'complete: 0,' to the defaults, this will allow you to
run a subsequent function once the effect has completed. (This is the
first step of three).

Step 2:
Register the function within the Effect you would like to extend the
onComplete handler to. I needed this for the Effect.Fade and
Effect.Appear functions.

Example: Effect.Fade (starts around line 535)

Effect.Fade = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  var options = Object.extend({
from: element.getOpacity() || 1.0,
to:   0.0,
afterFinishInternal: function(effect) {
 if(effect.options.complete != 0){
 effect.options.complete();
 }
  if (effect.options.to!=0) return;
  effect.element.hide().setStyle({opacity: oldOpacity});
}
  }, arguments[1] || { });
  return new Effect.Opacity(element,options);
};

*on the afterFinishInternal you know that the effect has finished, so
you then ask whether or not the option for complete (onComplete) was
issued and piped into the function, if so you allow Javascript to read
the string as a function and you are golden.

Step 3: Using the onComplete (complete) option in your code.

example:
function fadeObj(obj,func){
Effect.Fade($(obj),{duration:1,complete:func});
}

function setInStone(){
 alert('onComplete handler working for effects.js');
}

usage:
fadeObj('fadediv',setInStone);

I hope this helps anyone else who ran into the same issue. I wanted to
simulate the functionality of the caurina Tweener methods from
actionscript 3, or the complete handler from the SPRY lib in the more
useful effect.js.

Cheers,
Scott Haines
Newfront Creative
http://www.newfrontcreative.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] Auto Submit on AutoComplete Selection Help

2009-05-18 Thread Scott Z

Can anyone point me in the right direction to making my form submit
when a selection is made from the autocomplete suggestions? Thanks!

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



[Proto-Scripty] Re: Simple $( ) question

2008-11-07 Thread Scott

Thanks everyone.  Very helpful.

I also like the Prototype 'stripTags()' method.  Very useful!


On Nov 6, 3:55 am, T.J. Crowder [EMAIL PROTECTED] wrote:
 Hi,

  Should I be able to say the following?

    var total = parseFloat($('foo'));

 No, $() gives you -- as you discovered -- a reference to the Element
 object for the span, not the text of its content.  It's an object with
 lots of properties and methods.  To get the text of its content, you
 have to go get it.  This HTML:

    span id='foo'50/span

 Consists of two nodes:  A span element containing a text node.  The
 text node's value is 50, so you *could* do this:

 var total = parseFloat($('foo').firstChild.nodeValue);

 That might meet your needs provided you know for sure that the HTML
 will look exactly like that and not (for instance) like this for some
 reason:

    span id='foo'span class='numeric'50/span/span

 or indeed this:

    span id='foo'/span

 ...because in each case that's a different structure and the code
 above would break.

 If what you're looking for is the text content of the Element and all
 of its children, bundled up together, there's the DOM3 'textContent'
 property[1] supported by Firefox (and other Gecko-based browsers),
 Opera, and Safari (at least, Safari on Windows).  IE6 doesn't support
 it (don't know about IE7), but it has an equivalent called
 innerText[2].  So you can test whether the browser provides
 textContent, use it if so, and if not see if it provides innerText.

 [1]http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
 [2]http://msdn.microsoft.com/en-us/library/ms533899(VS.85).aspx

 Alternately, there's a very handy property called 'innerHTML' that's
 not a W3C standard but is widely-supported; it was an IE thing that's
 been picked up by other browsers.  It gives you the HTML
 representation of everything inside the element, including the tags.
 Now, in your situation you don't want the tags, but Prototype provides
 a handy stripTags() method on the String object, and so:

 var total = $('foo').innerHTML.stripTags();

 ...would give you the equivalent of textContent/innerHTML another way.

 Finally, you could do a recursive descent with pure DOM methods
 collecting the nodeValue of all text nodes you found.  But it would
 probably be slower than the shortcuts provided by browsers.

 Anyone out there have better approaches than textContent/innerText or
 using innerHTML and stripping the tags?

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com

 On Nov 6, 2:06 am, Scott [EMAIL PROTECTED] wrote:

  If I have an element:

    span id='foo'50/span

  Should I be able to say the following?

    var total = parseFloat($('foo'));

  Instead, I am getting a return value of:

    [object HTMLSpanElement]

  and parseFloat is returning NaN.

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



[Proto-Scripty] Simple $( ) question

2008-11-06 Thread Scott

If I have an element:

  span id='foo'50/span

Should I be able to say the following?

  var total = parseFloat($('foo'));

Instead, I am getting a return value of:

  [object HTMLSpanElement]

and parseFloat is returning NaN.

Thanks in advance.

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