[Proto-Scripty] Re: limit droppables

2010-03-29 Thread ColinFine


On Mar 28, 2:21 pm, HotShot hs...@gmx.net wrote:
 I would like to know if there is a way to limit a drop area to a
 certain number of items. When this limit is reached the drop area
 should no longer accept any draggables. Already dropped draggables
 should be removable from the drop area so that new draggable can be
 dropped.

 Is there a way to realize that?

Not automatically, as you are talking about behaviour that changes
between one drag and the next.

But it's not too hard to program it. What I would do is have a
function which examines the drop area and adds/removes a class 'can-
accept' depending on whether it is full or not.
Then set the 'accept' property in your Droppables call to 'can-
accept'.

You will presumably set the 'can-accept' class appropriately when you
first generate the page (or call the function to update it when you
have loaded the page), and call the function at the end of every
'onDrop'.

Removing an existing drop is something you will have to program
yourself.

-- 
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: draggable problems

2010-03-29 Thread bill

On 3/28/2010 11:30 PM, Martin wrote:

u could use the hande option 
http://wiki.github.com/madrobby/scriptaculous/draggable

or you can modify dragdrop.js . i had an UL with scrollbars so i added
UL here and fixed what you describe in 1)

line 300+

  initDrag: function(event) {
 if(!Object.isUndefined(Draggable._dragging[this.element])
   Draggable._dragging[this.element]) return;
 if(Event.isLeftClick(event)) {
   // abort on form elements, fixes a Firefox issue
   var src = Event.element(event);
   if((tag_name = src.tagName.toUpperCase())  (
 tag_name=='INPUT' ||
 tag_name=='SELECT' ||
 tag_name=='OPTION' ||
 tag_name=='BUTTON' ||
 tag_name=='TEXTAREA' ||

)) return;


   


Thank you very much  !
bill

On Mar 28, 12:41 pm, billwill...@techservsys.com  wrote:
   

When I set a div to draggable I get two problems:
1) when I try to scroll it by dragging the scroll bar, I drag the whole
div instead of scrolling it
2) when I try to copy text from it, I drag the div instead of
highlighting text.

Perhaps there is a way I could set up a handle to drag it by (a small
area, maybe 25 x 25 px) when clicked on would drag the div, or does
anyone have any suggestions ?

--
Bill Drescher
william {at} TechServSys {dot} com
 
   



--
Bill Drescher
william {at} TechServSys {dot} 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-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] $$() for a specific root.

2010-03-29 Thread Richard Quadling
Hi,

I can use ...

$$('#tbl_Charges .dtl_Tyre, #tbl_Charges .dtl_Repair, #tbl_Charges
.dtl_Service, #tbl_Charges .dtl_Blank').each(function(el){...});

I now want to do a further $$ on el in for each...

el.$$('.rCharge, .rValue, .rDesc').each(function(el2){...});

but I don't know how to use $$ in this way.

I think I need to use Selector, but I don't know the proper CSS rules
in this instance.

Regards,

Richard.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
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-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] $$() for a specific root.

2010-03-29 Thread Guillaume Lepicard
hi,

use the select method of elements :
$$('#tbl_Charges .dtl_Tyre, #tbl_Charges .dtl_Repair, #tbl_Charges
.dtl_Service, #tbl_Charges .dtl_Blank').each(function(el){
el.select('.rCharge, .rValue, .rDesc').each(...)
});


On Mon, Mar 29, 2010 at 5:23 PM, Richard Quadling
rquadl...@googlemail.comwrote:

 Hi,

 I can use ...

 $$('#tbl_Charges .dtl_Tyre, #tbl_Charges .dtl_Repair, #tbl_Charges
 .dtl_Service, #tbl_Charges .dtl_Blank').each(function(el){...});

 I now want to do a further $$ on el in for each...

 el.$$('.rCharge, .rValue, .rDesc').each(function(el2){...});

 but I don't know how to use $$ in this way.

 I think I need to use Selector, but I don't know the proper CSS rules
 in this instance.

 Regards,

 Richard.

 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.



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



[Proto-Scripty] hash:zero

2010-03-29 Thread chrysanthe m
Hello
I am sure this is documented somewhere, I have googled and looked at the api
however it is still unclear.  How can I zero our all the keys/values of a
prototype hash without iterating over it?  Sorry if it is documented, I
couldn't find an api faq.  tia.

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



[Proto-Scripty] 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.



Re: [Proto-Scripty] hash:zero

2010-03-29 Thread Walter Lee Davis
So if you had a hash of N length and you wanted to end up with a hash  
with no members? You could try setting its length to 0. Not sure if  
that works, but it would be the first thing I would try.


Walter

On Mar 29, 2010, at 2:26 PM, chrysanthe m wrote:


Hello
I am sure this is documented somewhere, I have googled and looked at  
the api
however it is still unclear.  How can I zero our all the keys/values  
of a
prototype hash without iterating over it?  Sorry if it is  
documented, I

couldn't find an api faq.  tia.

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




--
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] -[Accordion]-...

2010-03-29 Thread Hariz Soleminio
Thanks for the Reply Sir Walter,

Im looking checking for the moo.fx accordion for prototype accordion.
However, the documentation is not so good. 
I can't see any good tutorial in google too..

anyway thanks,





From: Walter Lee Davis wa...@wdstudio.com
To: prototype-scriptaculous@googlegroups.com
Sent: Monday, March 29, 2010 8:07:10 AM
Subject: Re: [Proto-Scripty] -[Accordion]-...

Have a look over at Scripteka.com -- the canonical repository for all things 
Prototype extension-shaped. There are loads of different ways to skin this cat, 
including writing your own long-hand. I think it takes maybe 12 lines of script 
if you space it out and make it all purty.

For this structure:

div id=outer
h3First segment/h3
div class=inner
pFirst segment's content here./p
/div
...
h3Last segment/h3
div class=inner
pLast segment's content here./p
/div
/div

You could do this:
//include just prototype.js in your page head

//roll up all but the first one
var bodies = $$('.inner');
bodies.invoke('hide').first().show();

$('outer').select('h3').invoke('observe','click',function(evt){
//if you want only one to be open at a time:
bodies.invoke('hide');
this.next('div').show();
});

If you link the Scriptaculous Effects library into your page after Prototype, 
then you can animate the transition thus:

$('outer').select('h3').invoke('observe','click',function(evt){
//if you want only one to be open at a time:
bodies.findAll(function(elm){return elm.visible();}).invoke('slideUp');
this.next('div').slideDown();
});

That's all untested but it should get you nearly there.

Walter

On Mar 28, 2010, at 7:33 PM, Hariz Soleminio wrote:

 Hi Guys,
 
 hmmm i've wondering if there is such an easy way to use accordion in 
 prototype guys?
 is there such plugins addons for prototype?
 Or should i used the scriptacolous 2 and use Effect.SlideUp effect?
 
 Thanks Prototype Fans...
 
 
 
  Connect instantly with more friends on your blog and personal website? 
 Create your latest Pingbox today! http://ph.messenger.yahoo.com/pingbox
 
 --You received this message because you are subscribed to the Google Groups 
 Prototype  script.aculo.us group.
 To post to this group, send email to prototype-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to 
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/prototype-scriptaculous?hl=en.
 

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


  quot;Try the new FASTER Yahoo! Mail. Experience it today at 
http://ph.mail.yahoo.comquot;

-- 
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] -[Accordion]-...

2010-03-29 Thread Walter Lee Davis
No problem. But seriously it's a very simple problem to solve  
yourself, and then you learn something. I just did this copying and  
pasting from my example code here. One minor tweak away from the basic  
method I proposed when using Scriptaculous, and that just gets you the  
ability to set duration and queue on the effect.


http://jsbin.com/imuma3

By the way, has anybody seen the new jsBin?! Really nice, and no more  
halloween color scheme either.


Walter

On Mar 29, 2010, at 3:17 PM, Hariz Soleminio wrote:


Thanks for the Reply Sir Walter,

Im looking checking for the moo.fx accordion for prototype accordion.
However, the documentation is not so good.
I can't see any good tutorial in google too..

anyway thanks,





From: Walter Lee Davis wa...@wdstudio.com
To: prototype-scriptaculous@googlegroups.com
Sent: Monday, March 29, 2010 8:07:10 AM
Subject: Re: [Proto-Scripty] -[Accordion]-...

Have a look over at Scripteka.com -- the canonical repository for  
all things Prototype extension-shaped. There are loads of different  
ways to skin this cat, including writing your own long-hand. I think  
it takes maybe 12 lines of script if you space it out and make it  
all purty.


For this structure:

div id=outer
h3First segment/h3
div class=inner
pFirst segment's content here./p
/div
...
h3Last segment/h3
div class=inner
pLast segment's content here./p
/div
/div

You could do this:
//include just prototype.js in your page head

//roll up all but the first one
var bodies = $$('.inner');
bodies.invoke('hide').first().show();

$('outer').select('h3').invoke('observe','click',function(evt){
   //if you want only one to be open at a time:
   bodies.invoke('hide');
   this.next('div').show();
});

If you link the Scriptaculous Effects library into your page after  
Prototype, then you can animate the transition thus:


$('outer').select('h3').invoke('observe','click',function(evt){
   //if you want only one to be open at a time:
   bodies.findAll(function(elm){return  
elm.visible();}).invoke('slideUp');

   this.next('div').slideDown();
});

That's all untested but it should get you nearly there.

Walter

On Mar 28, 2010, at 7:33 PM, Hariz Soleminio wrote:


Hi Guys,

hmmm i've wondering if there is such an easy way to use  
accordion in prototype guys?

is there such plugins addons for prototype?
Or should i used the scriptacolous 2 and use Effect.SlideUp effect?

Thanks Prototype Fans...



Connect instantly with more friends on your blog and personal  
website? Create your latest Pingbox today! http://ph.messenger.yahoo.com/pingbox


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




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



 quot;Try the new FASTER Yahoo! Mail. Experience it today at http://ph.mail.yahoo.com 
quot;


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




--
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-03-29 Thread T.J. Crowder
Hi,

You can't make it wait, no. The way to do this is to have your
`userChooser` function accept a callback function reference that the
user choosing code will call when the user makes a choice. The
`userChooser` function would then return immediately, but later the
event of the user making a choice would trigger the callback function.

So for instance;

function userChooser(callback) {
new Ajax.Updater('divID', 'userChooser.asp', {
onSuccess: updateSuccess
});

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

function chosenClick(event) {
var theDiv;

event.stop();
theDiv = $('divID');
theDiv.stopObserving('click', chosenClick);
callback(theDiv.down('select[name=choices]').getValue());
}
}

And using it:

function foo() {

userChooser(choiceMade);

function choiceMade(choice) {
/* ...do something with the 'choice' value...*/
}
}

(Note that `foo` returns immediately, *before* the choice is made.)

There, we're calling `userChooser` and passing in `choiceMade` as the
`callback` parameter. The Ajax.Updater does its thing and, if
successful, hooks up a handler on the `btnChoose` input element. When
that's clicked, it calls `chosenClick`, which calls the callback with
the value of the `choices` select element. (You'd probably remove the
UI related to choosing in the `chosenClick` function.) There's
obviously a bit of error handling I've left out of the above.

It's a real shift in the way you think about user (and other)
interaction, but once you get the hang of it, it's really powerful.
You basically think in terms of states the application may be in, and
transitions between those states. You have the state before you ask
the question, the state of asking the question, and the state of
having gotten your answer.

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


On Mar 29, 7:37 pm, Scott counterstre...@gmail.com wrote:
 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.