A while back I was on with a problem having to do with a hiding and show questions in a table based form based on whether a user selected yes or no radio buttons. If they selected yes to any of the 6 questions then they would be shown additional questions that they would be required to answer. With your help I was able to implement a working solution that worked great. This is the thread--> http://groups.google.com/group/rubyonrails-spinoffs/tree/browse_frm/thread/11369aed115a4cd8/805a002c600cc960?rnum=1&_done=%2Fgroup%2Frubyonrails-spinoffs%2Fbrowse_frm%2Fthread%2F11369aed115a4cd8%3Ftvc%3D1%26#doc_805a002c600cc960 However since then the form as become a bit more complex. If they select yes for each question a hidden <tbody> with additional questions will be shown. I have this working using an onclick and element.hide and element.show for each question. However, Filemaker is the database we are using, and so the multiple inlines on the form really slow things down. To help speed things up I would like to only load the hidden tbody elements and questions if the user clicks yes. Initially I thought I could leave the tbody element empty and then call the include using prototype''s ajax.updater, which works, until they select no. If they select no, then the question''s are still visible..if I add onclick ="element.hide"; to the no radio button, then it will hide it, but then if they select yes again it won''t show. I apologize if this doesn''t make any sense, and please let me know if you need any additional information. Or some example code. I would post a link, but I don''t have one available. Thank you in advance. ~Becca --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Any ideas or suggestions would be much appreciated? If I need to supply more information or am being confusing, or off in my thinking, please let me know. On Apr 1, 4:10 pm, kodiacat <kodia...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> A while back I was on with a problem having to do with a hiding and > show questions in a table based form based on whether a user selected > yes or no radio buttons. If they selected yes to any of the 6 > questions then they would be shown additional questions that they > would be required to answer. With your help I was able to implement a > working solution that worked great. > > This is the thread-->http://groups.google.com/group/rubyonrails-spinoffs/tree/browse_frm/t... > > However since then the form as become a bit more complex. If they > select yes for each question a hidden <tbody> with additional > questions will be shown. I have this working using an onclick and > element.hide and element.show for each question. However, Filemaker > is the database we are using, and so the multiple inlines on the form > really slow things down. To help speed things up I would like to only > load the hidden tbody elements and questions if the user clicks yes. > Initially I thought I could leave the tbody element empty and then > call the include using prototype''s ajax.updater, which works, until > they select no. If they select no, then the question''s are still > visible..if I add onclick ="element.hide"; to the no radio button, > then it will hide it, but then if they select yes again it won''t show. > I apologize if this doesn''t make any sense, and please let me know if > you need any additional information. Or some example code. I would > post a link, but I don''t have one available. > > Thank you in advance. > ~Becca--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
use element.toggle() or element[this.checked? ''show'': ''hide''](); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I don''t see how using this would help? Currently I have the ajax working using element.show and element.hide, however each of these divs have inlines in them, and this slows things down, so in an effort to make things faster. I thought it would be better to only load the divs when needed, however I am having trouble getting this to work how I need it to... On Apr 9, 11:06 am, jdalton <John.David.Dal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> use element.toggle() or element[this.checked? ''show'': ''hide'']();--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Instead of hiding it then, use $(''tbody_id'').update('''') to clear it again, which will leave things ready for the updater to re-fill it again later. Walter On Apr 1, 2008, at 5:10 PM, kodiacat wrote:> Initially I thought I could leave the tbody element empty and then > call the include using prototype''s ajax.updater, which works, until > they select no. If they select no, then the question''s are still > visible..if I add onclick ="element.hide"; to the no radio button, > then it will hide it, but then if they select yes again it won''t show.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Great idea! I haven''t tried it yet, but I believe this is what I have been looking for. Thanks, I will let you know how this works. On Apr 9, 12:03 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> Instead of hiding it then, use $(''tbody_id'').update('''') to clear it > again, which will leave things ready for the updater to re-fill it > again later. > > Walter > > On Apr 1, 2008, at 5:10 PM, kodiacat wrote: > > > Initially I thought I could leave the tbody element empty and then > > call the include using prototype''s ajax.updater, which works, until > > they select no. If they select no, then the question''s are still > > visible..if I add onclick ="element.hide"; to the no radio button, > > then it will hide it, but then if they select yes again it won''t show.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Becca "add onclick ="element.hide"; to the no radio button, then it will hide it, but then if they select yes again it won''t show. " Thats why i said use "use element.toggle() or element[this.checked? ''show'': ''hide''](); " instead of element.hide(); you dont have to have tons of inlines either. Attach one observer to the parent element and use event.element() to get the element clicked and proceed from there. 1 observer vs hundreds/thousands. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I had another thought -- why not simply put everything you will ever show in the page, but hide the things you don''t need until they''re needed. If you do this hiding inside this block, up in the head of the page: document.observe(''dom:loaded'',function(){ //your hide statement here, perhaps this: $$(''.initially_hidden'').invoke(''hide''); }); then it will happen before the page ever shows in the browser. (in 1.6 or greater, that is) So you go through and build your entire extended form, but the things you want to hide for when you really need them you add the className initially_hidden to them. And you also give them an ID so you can show them later. This will be a lot faster for the user, since everything is already there. Unless your FMP server is completely under water, it''s going to be fairly straightforward to assemble a page with all the options showing in one pass and then hide the "expert" stuff, rather than pecking at it over and over. I believe that a lot of the pain of FMP is waiting for it to initialize a view, kinda like CGI, right? Walter On Apr 9, 2008, at 1:30 PM, kodiacat wrote:> > Great idea! I haven''t tried it yet, but I believe this is what I have > been looking for. Thanks, I will let you know how this works. > > On Apr 9, 12:03 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> Instead of hiding it then, use $(''tbody_id'').update('''') to clear it >> again, which will leave things ready for the updater to re-fill it >> again later. >> >> Walter >> >> On Apr 1, 2008, at 5:10 PM, kodiacat wrote: >> >>> Initially I thought I could leave the tbody element empty and then >>> call the include using prototype''s ajax.updater, which works, until >>> they select no. If they select no, then the question''s are still >>> visible..if I add onclick ="element.hide"; to the no radio button, >>> then it will hide it, but then if they select yes again it won''t >>> show. > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---