[Proto-Scripty] show/hide and return false;

2008-12-10 Thread Cyrus

Hi,

I just programmed a simple show/hide feature: You click on a link and
extra information is displayed. Click again and it is hidden.

The link has a href like #moreInfoContent. When I add an
onclick=return false; I have the desired result that the href is not
displayed in the addressbar. When I try to add this return false in my
javascript (unobstrusive) it doesn't work for me. The link is
displayed in the adress bar so the browser jumps to that position.

Here my html code:

a href=#moreInfoContent id=moreInfo class=titleShow me more/
a
div id=moreInfoContent class=moreInformationMore Information/
div

This is the javascript:

function openMoreInfo(event) {
if (Element.hasClassName(this, 'more')) {
new Effect.BlindUp(this.identify() + 'Content', { duration: 0.2 
});
Element.removeClassName(this, 'more');
}
else {
new Effect.BlindDown(this.identify() + 'Content', { duration:
0.2 });
Element.addClassName(this, 'more');
}
return false; // if I add this directly to the link onclick=return
false; it works!
}

// when the dom is fully loaded, execute these scripts
document.observe(dom:loaded, function() {
// init more information handling
$$('.moreInformation').invoke('hide');
$$('.title').invoke('observe', 'click', openMoreInfo);
});
--~--~-~--~~~---~--~~
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] Extending Event object with custom events

2008-12-10 Thread Rauan Maemirov

Hi list. I'm trying to extend event object.

Let's say that i want to observe 'custom:myevent' event.

How should I name it?

Object.extend(Event, (function(){
return {

custom_myevent: function(element, eventName, rules){
//some stuff
/*
   i could call fire('custom:myevent'); i know it.
*/
}
}
})());

Element.addMethods({custom_myevent: Event.custom_myevent});
Object.extend(document, {custom_myevent: Event.custom_myevent});


I tried to make analogy on 'dom:loaded' and took a look on prototype
source.

'dom:loaded' is observing from the load of document and then simply
fires event.

But I need to observe my custom event only when I call it.
--~--~-~--~~~---~--~~
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] Re: show/hide and return false;

2008-12-10 Thread Cyrus

thank you very much :)

On 10 Dez., 14:07, Walter Lee Davis [EMAIL PROTECTED] wrote:
 Add one line, as below.

 On Dec 10, 2008, at 6:50 AM, Cyrus wrote:



  Hi,

  I just programmed a simple show/hide feature: You click on a link and
  extra information is displayed. Click again and it is hidden.

  The link has a href like #moreInfoContent. When I add an
  onclick=return false; I have the desired result that the href is not
  displayed in the addressbar. When I try to add this return false in my
  javascript (unobstrusive) it doesn't work for me. The link is
  displayed in the adress bar so the browser jumps to that position.

  [snip]

  function openMoreInfo(event) {

         Event.stop(event);



     if (Element.hasClassName(this, 'more')) {
             new Effect.BlindUp(this.identify() + 'Content', { duration: 0.2 
  });
  [snip]

 You may want to change the use of the word event as a private  
 variable, I know that IE can sometimes get cranky about that (at least  
 that's been my apocryphal observation). I use evt, personally, or some  
 variation like that.

 Also, the syntax I wrote works for Prototype 1.5 and up, but the  
 modern cool 1.6+ way would be to write it as event.stop() (or  
 evt.stop() if you're me).

 Walter
--~--~-~--~~~---~--~~
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] Re: Submit a form using enter

2008-12-10 Thread Hector Virgen
This is untested, but I would probably do something like this:

$$('form[name=login_form]').invoke('observe', 'keydown', function(event)
{
if (event.keyCode === 13) {
event.findElement('form').submit();
}
});

-Hector


On Wed, Dec 10, 2008 at 4:46 AM, Dave L [EMAIL PROTECTED] wrote:


 Im not sure I understand.  login_form is the id of the form that I am
 trying to submit.  and form_submit is the id of the actual submit
 button. I tried the following:

 document.form.login_form.onkeydown=if(event.keyCode==13)
 {this.form.submit();return false;};

 and also

 $('login_form').form_submit.onkeydown=if(event.keyCode==13)
 {this.form.submit();return false;};

 but no go.  Thanks for your input.

 On Dec 10, 1:03 am, pradeep saraswati [EMAIL PROTECTED] wrote:
   hai
 
  u are using $('form_submit')  does form_submit is the id of the
  form
 
  then it will surely does not gonna work in I.E
 
  so you specify a name to the formand access the form
 
  document.form.formname.onkeydown this will work in ie...
 
  i too faced this issuejust try this u r problem will be solved
 
  if u are too much particular in accessing form using $...then use $F and
  never access form using the id
  IE will never know..what you are doing...if you access form by id
 
  Regards
  spradeepkumar
 


--~--~-~--~~~---~--~~
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] Re: Ajax.InPlaceEditor value needs to be part of the URL

2008-12-10 Thread Russell

I have enabled query strings and if I call the url
http://test/index.php?c=appm=updateUserJobid=548506level=S it
returns updaed value from the database just fine.  When I use my IPE
as coded below it I get the text box, make my change but it returns my
full index.php and not the new value.

script type=text/javascript
var editor = new Ajax.InPlaceEditor('user?=$i?', '/index.php', {
callback: function(form, value) { return
'c=appm=updateUserJobid=548506level='+escape(value) }
})

/script


On Dec 9, 10:44 am, Walter Lee Davis [EMAIL PROTECTED] wrote:
 On the CodeIgniter side, I think you will need to step outside of CI's  
 routing in order to do this. I know it's possible to mix and match CI  
 routing and traditional GET requests in the same application -- it's  
 just a matter of knowing what all you will need to pass to the  
 application. Try reading through the source in the router and see what  
 variables it expects. In my own framework (heavily influenced by CI  
 and Rails) I need to see model=fooaction=barid=123, so if you pass  
 all that as a querystring request to routing.php, you get a page, same  
 as if you went to mysite.com/foo/bar/123.

 On the IPE side, you can modify the name of the fields sent to the  
 server through the POST request by means of the callback option in the  
 parameters. Further, you can modify the underlying Ajax call (change  
 it to GET, maybe?) using the ajaxOptions parameter.

 Have a read on the wiki: 
 http://github.com/madrobby/scriptaculous/wikis/ajax-inplaceeditor
  

 Walter

 On Dec 8, 2008, at 3:04 PM, Russell wrote:





  I am using the CodeIgniter framework for PHP and need the value from
  my InPlaceEditor to pass as a straight value (i.e. /something) instaed
  of the way it does now (?value=something)

  script type=text/javascript
     var editor = new Ajax.InPlaceEditor('user?=$i?', '/index.php/app/
  updateUserJob.php/?=$data[$i]-empNum?/');
  /script

  my url now is '/index.php/app/updateUserJob.php/123456/?
  value=something and I need it to be
  '/index.php/app/updateUserJob.php/123456/something

  is this possible?- Hide quoted text -

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



[Proto-Scripty] Re: select only text (i.e. textnodes, probably) using $$

2008-12-10 Thread RobG



On Dec 11, 3:25 am, lskatz [EMAIL PROTECTED] wrote:
 I finally got around to this, and it turns out that even though the
 approach is good, I cannot insert HTML tags.  I chose to not use
 recursion to make it simple.  The problem is that it uses each
 character literally and displays the htmlentities instead of actually
 making html tags.

Because you are modifying the text node's nodeValue attribute, not its
innerHTML property so the replacement text isn't parsed as HTML.


--
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---