[Proto-Scripty] Trying to toggle the content of elements
Hi, i have this code: div style=display: none id=test Hello /div div id=test Bye /div div id=link ?php //echo link_to_function(Link, $('test').toggle()) ? a href=# onclick=$('test').toggle() Click here/a /div What i expected: each time you click Click here, Hello or Bye is showed. What actually happens: just Hello appears and disappears. Bye is always there... What should i do? Javi -- 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: Trying to toggle the content of elements
Hi thanks, On Jan 29, 2:59 pm, Walter Lee Davis wa...@wdstudio.com wrote: then look at Element.update for one possible way to do this with a single DIV. I tried but i dont know how to do it. Another way would be to have two different elements (with distinct IDs), and then set them to switch back and forth so only one is ever visible at a time. This worked. Here you have: script function conmutarContenido(){ $('hola').toggle(); $('adios').toggle(); } /script div style=display: none id=hola Hola /div div id=adios Adios /div div id=link ?php //echo link_to_function(Link, $('test').toggle()) ? a href=# onclick=conmutarContenido() Click here/a /div BTW, which PHP framework is this code from? Why do you ask? because this line?: ?php //echo link_to_function(Link, $('test').toggle()) ? It's a symfony helper. Javi -- 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: Prototype update suggestion: show/hide, CSS, unobtrusive
Thanks, Those were exactly the kinds of workarounds I was looking for. Still wouldn't it make more sense for Prototype to handle this...? On Jan 28, 11:08 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, If the goal is to unhide __with an effect__ and you don't want to use inline styles to hide them initially (I wouldn't want to; all those style='display: none' attributes cluttering up my markup...), here are a few ideas: * Add an 'h' style to your stylesheet and change your current class=dealerAddress lines to class=dealerAddress h. Then at page load time: var addresses; addresses = $$(.dealerAddress); addresses.invoke('hide'); addresses.invoke('removeClassName', 'h'); // ...and then fire off the scripty effects This is probably my favorite, because it should be minimal impact on several fronts. I normally don't like to visit lists of elements on page load like that because on IE there's overhead involved in extending them (extension is at the prototype -- small 'p' -- level in other browsers and doesn't have that issue). But if you're going to fire off a scripty effect anyway, you're going to have that overhead anyway, so... * Wrap them in a container that you hide. Then, at page load time: var container; container = $('containerId'); container.select('.dealerAddress').invoke('hide'); container.show(); // ...and then fire off the scripty effects * Do the stylesheet trick, but it's essentially the same thing: Start off with the dealerAddress rule having display: none, then at page load time: var addresses; addresses = $$(.dealerAddress); addresses.invoke('hide'); // ...find the style sheet and rule and remove the display: none // ...fire off the scripty effects HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Jan 28, 3:32 pm, kenxle kenstcl...@gmail.com wrote: Again, looking to unhide with an effect. Just changing class name won't allow me the effect. Or am I mistaken? On Jan 26, 4:13 pm, Diodeus diod...@gmail.com wrote: Try: $$(.dealerAddress).each(function(element) {element.removeClassName(dealerAddress)}); This will unhide them. Not sure if this will be any faster. On Jan 26, 1:06 pm, kenxle kenstcl...@gmail.com wrote: Here's the problem I'm running into: $$(.dealerAddress).invoke(hide); takes too long because a very large page structure is loading, and there are many dealer addresses, so my page shows everything, then hides it, when it loads. Ew. To fix this, I put .dealerAddress{display:none;} in my CSS style sheet. However, when Prototype runs its show/hide functions (I'm using toggle), it only seems to be adding the attribute ... style=display:none or removing it. Which means that my style sheet takes back over when it removes the attribute, and the tag ends up never showing. I fixed it by putting my style declaration inline in the tag, as Prototype does, but I find this solution hackish and obtrusive. Why doesn't Prototype toggle from ... style=display:none to ... style=display:[inline||block]? Wouldn't this solve my problem, as the inline style declaration would override the style sheet declaration? If so, I'd like to propose it as an update. Discussion or alternate solutions welcome. Thanks. (P.S. jQuery handles this situation without issue...) -- 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
Here's what worked. I did this: var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm'; var target = 'ajax_famMbr_div'; var myAjax = new Ajax.Updater(target, url, {method:'get', parameters: {a: $F('member_nm'), b: $F('member_address'), c: $F ('member_ph'), d: $F('member_email'), e: $F('date_member_birth'), f: $F ('member_sex'), g: $F('member_ethnicity'), btn: $F ('AddBtn_famMbr')} }); Instead of doing this: var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm'; var pars = 'a='+escape($F('member_nm')) + '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}); -- 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: Couldnot solve the problem with call class method with parameters
I'm sorry, I was wrong - I incorrectly described the function declaration in inherited object Thanks for response On 28 янв, 00:23, T.J. Crowder t...@crowdersoftware.com wrote: Hi, As quoted, that code is fine and will work if you do this: var x = new TObj(); x.metod1(); ...that will call x.method2 with a = 1, b = 2. Can you give a complete example[1] demonstrating the problem? [1]http://proto-scripty.wikidot.com/self-contained-test-page -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Jan 27, 8:00 pm, buda www...@pochta.ru wrote: I have a class var TObj = Class.create({ initialize: function() {... }, metod1: function() { this.method2(1,2); --- cal method2 with parameters }, method2: function(a, b){ var aa = a; -- a b is undefined! } }); why in method2 parameters a and b is undefined?- Скрыть цитируемый текст - - Показать цитируемый текст - -- 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.