[Proto-Scripty] Re: Creating Checked Radio buttons, not working in IE
Yes walter is correct... As far as i know you cannot insert an element into another element if it does not exist in the DOM (as the element is still an object that resides in memory at the time) .. though i could be wrong - Original Message - From: Walter Lee Davis wa...@wdstudio.com To: prototype-scriptaculous@googlegroups.com Sent: Wednesday, March 04, 2009 3:24 AM Subject: [Proto-Scripty] Re: Creating Checked Radio buttons, not working in IE Try inserting it, then checking it after it's in the DOM. Also, try setting input.checked = true rather than adding that as a part of the initial new Element deal. if ( i == 1 ) { var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); input.checked = true; }else{ var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); } See if that helps. Walter On Mar 3, 2009, at 6:49 PM, jachin wrote: Does anyone know of a work around to this problem? A way to get a dynamically generated radio button selected? --~--~-~--~~~---~--~~ 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: Creating Checked Radio buttons, not working in IE
2009/3/4 Alex Mcauley webmas...@thecarmarketplace.com: Yes walter is correct... As far as i know you cannot insert an element into another element if it does not exist in the DOM (as the element is still an object that resides in memory at the time) .. though i could be wrong - Original Message - From: Walter Lee Davis wa...@wdstudio.com To: prototype-scriptaculous@googlegroups.com Sent: Wednesday, March 04, 2009 3:24 AM Subject: [Proto-Scripty] Re: Creating Checked Radio buttons, not working in IE Try inserting it, then checking it after it's in the DOM. Also, try setting input.checked = true rather than adding that as a part of the initial new Element deal. if ( i == 1 ) { var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); input.checked = true; }else{ var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); } See if that helps. Walter On Mar 3, 2009, at 6:49 PM, jachin wrote: Does anyone know of a work around to this problem? A way to get a dynamically generated radio button selected? Even less code... document.observe(dom:loaded, function() { var my_list = $('my_list'); for( i = 0; i 3; i++ ) { var li = new Element( 'li' ); var input = new Element( 'input', { 'type': 'radio', 'value': i, 'name': 'test', 'checked' : (i = 1) } ); li.insert(input); my_list.insert(li); } }); -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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: Creating Checked Radio buttons, not working in IE
have you trie using Builder to create and register your element? also, try setting the checked attribute to 'checked' instead of 'true' -Original Message- Date: Wednesday, March 04, 2009 4:38:06 am To: prototype-scriptaculous@googlegroups.com From: Richard Quadling rquadl...@googlemail.com Subject: [Proto-Scripty] Re: Creating Checked Radio buttons, not working in IE 2009/3/4 Alex Mcauley webmas...@thecarmarketplace.com: Yes walter is correct... As far as i know you cannot insert an element into another element if it does not exist in the DOM (as the element is still an object that resides in memory at the time) .. though i could be wrong - Original Message - From: Walter Lee Davis wa...@wdstudio.com To: prototype-scriptaculous@googlegroups.com Sent: Wednesday, March 04, 2009 3:24 AM Subject: [Proto-Scripty] Re: Creating Checked Radio buttons, not working in IE Try inserting it, then checking it after it's in the DOM. Also, try setting input.checked = true rather than adding that as a part of the initial new Element deal. if ( i == 1 ) { var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); input.checked = true; }else{ var input = new Element( 'input',{ 'type': 'radio', 'val --~--~-~--~~~---~--~~ 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: Creating Checked Radio buttons, not working in IE
On Mar 4, 7:13 pm, Alex Mcauley webmas...@thecarmarketplace.com wrote: Yes walter is correct... As far as i know you cannot insert an element into another element if it does not exist in the DOM I guess that by insert you mean append (and that isn't what Walter said). (as the element is still an object that resides in memory at the time) .. though i could be wrong Yes, you are wrong. :-( -- 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 prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Creating Checked Radio buttons, not working in IE
Try inserting it, then checking it after it's in the DOM. Also, try setting input.checked = true rather than adding that as a part of the initial new Element deal. if ( i == 1 ) { var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); input.checked = true; }else{ var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); } See if that helps. Walter On Mar 3, 2009, at 6:49 PM, jachin wrote: Does anyone know of a work around to this problem? A way to get a dynamically generated radio button selected? --~--~-~--~~~---~--~~ 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: Creating Checked Radio buttons, not working in IE
hi there Thanks Walter, your advise helped, here just the javascript that ended up working. (How about that the codes is even a bit tighter.) -jachin document.observe(dom:loaded, function() { var my_list = $('my_list'); for( i = 0; i 3; i++ ) { var li = new Element( 'li' ); var input = new Element( 'input', { 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); my_list.insert(li); if ( i == 1 ) { input.checked = true; } } }); On Mar 3, 9:24 pm, Walter Lee Davis wa...@wdstudio.com wrote: Try inserting it, then checking it after it's in the DOM. Also, try setting input.checked = true rather than adding that as a part of the initial new Element deal. if ( i == 1 ) { var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); input.checked = true;}else{ var input = new Element( 'input',{ 'type': 'radio', 'value': i, 'name': 'test' } ); li.insert(input); } See if that helps. Walter On Mar 3, 2009, at 6:49 PM, jachin wrote: Does anyone know of a work around to this problem? A way to get a dynamically generated radio button selected? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---