hahaha, all good manits hard to impart context sometimes, and if you were in front of me, you'd a been laughing while i asked the question. the reason being, i had been debugging my VERY FIRST ajax stuff for ~7 hrs, and you shouldnt try to pen an email at that point. hennyway.
i am using ajaxCfc to update the innerHtml value for a div. i have it jacked into my cfc which returns the data perfectly, displays it perfectly and all is well! however :) i want to setInterval()-ize it. and the way i work on things, i was going to try to pull it off myself with little tidbits of help. i understand and can read *most* javascript, i can write SOME, but its limited. i can usually hack multiple things together and come up with a perfect situation, or i resort to the list (charlie griefer) ahhaah anyway, i was working on getting the # of elements that i had so that i could do the - for loop - to start all of the setInterval() ping's to the cfc to update the divs at which point i emailed the list since i was stuck at ground zero on the update to my currently working schtuff. i realize that i could do two columns of radio buttons, a on/off column if you will on the page, and have the user click from "no" to "yes" but id rather just use checkboxes and name/id them all the same value and have the form.field value come back as a comma delimited list of values, i dont care about the order of them, just the inclusion of them is all i need. anyway, i can do it all in coldfusion with a mix of javascript for the ajax stuff, but id rather try to make it all javascript. you know, i could: 1. get the count, by the record set that comes back (supplant the value in the for loop with cf) 2. build a javascript array with cf code that does the iterating (clunky but it works) 3. and then do the setinterval() etc all that would be fine, but id rather do it with javascript :) tw On Mon, Feb 9, 2009 at 5:47 PM, Michael Grant <[email protected]> wrote: > > Yw rasta, > > I mean no offence by over explaining. I don't know you or your skill sets > very well and am just trying to help. Based on your most recent description > of what it is you want I don't see why you need javascript at all. That > being said I know js quite well and would be happy to help you when you're > ready. > > Cheers > > On Mon, Feb 9, 2009 at 5:37 PM, Rastafari <[email protected]> wrote: > >> >> :) come on man, this is basic html/cf stuff i know this stuff... i >> guess im just a bit >> lost in the javascript side of things, and thats where im hungup... >> ill explain more >> later, im trying to figure some other things out now... >> >> but thank ye... i think your original reply will be the best help. >> >> thanks too ian! >> tw >> >> On Mon, Feb 9, 2009 at 4:24 PM, Michael Grant <[email protected]> wrote: >> > >> > It looks like you are confusing the input parameters "name" and "id." >> They >> > are different. ID is part of the DOM and has nothing to do with forms >> > specifically. You can't get the id value from a form when it's submitted >> to >> > CF, only the name. That's what form.fieldNames consists of, names. >> > >> > I'm also a little confused as to whether you are talking about checkboxes >> or >> > radio buttons. Radio buttons can only have one selection per named group, >> > whereas checkboxes allow multiple selections within a group. >> > >> > Getting at them via cfml is simple. If the name of your checkbox group is >> > "myGroup" for instance, you would simply read #form.myGroup# on your cfm >> > page the form is submitted to. The value of form.myGroup will be a comma >> > delimited list of the values of each checked checkbox. >> > >> > So as an example your form page might have four checkboxes in the myGroup >> > group: >> > >> > checkbox #1: value=a checked=true >> > checkbox #2: value=b checked=false >> > checkbox #3: value=c checked=true >> > checkbox #4: value=d checked=true >> > >> > the value of form.myGroup would be: a,c,d >> > >> > If all you want to do is get the values using CF there's no need for >> > javascript at all. >> > Does that help or am I missing the question here? >> > On Mon, Feb 9, 2009 at 3:59 PM, Rastafari <[email protected]> wrote: >> > >> >> >> >> ok, first of all, thanks mike. >> >> second of all... >> >> >> >> how do you handle this then? >> >> i have a set of checkboxes that i want to get the value >> >> on the next page, via cfml. >> >> i also want them to be able to be checked as well >> >> as unchecked. and on my subsequent page, get to all of them. >> >> if i make them all the same id, then i can get them in a list >> >> from the form.fieldName, value. >> >> >> >> how would i do this same easy thing without the same id/name? >> >> >> >> tw >> >> >> >> On Mon, Feb 9, 2009 at 3:35 PM, Michael Grant <[email protected]> wrote: >> >> > >> >> > ...or you could just loop through it like I said. Three lines of code, >> >> zing >> >> > zing. Why does everyone always try to over complicate this stuff? >> >> > >> >> >> but in a situation where you only want one to be checkd >> >> >> at a time, how else do you do that? >> >> > Well radio buttons SHOULD have the same name. That's the whole point >> of >> >> the >> >> > name, to define a group of radio buttons. Radio buttons by definition >> >> only >> >> > allow one checked at a time within the group. >> >> > >> >> > >> >> > On Mon, Feb 9, 2009 at 3:27 PM, Rastafari <[email protected]> >> wrote: >> >> > >> >> >> >> >> >> k... thanks chowlee. >> >> >> ill be back with more questions >> >> >> >> >> >> :) >> >> >> >> >> >> tw >> >> >> >> >> >> On Mon, Feb 9, 2009 at 3:11 PM, Charlie Griefer >> >> >> <[email protected]> wrote: >> >> >> > >> >> >> > On Mon, Feb 9, 2009 at 11:50 AM, Tony <[email protected]> wrote: >> >> >> > >> >> >> >> >> >> >> >> i want that alert to tell me how many checkboxes with the >> >> >> >> id="updateFirmware" there are. >> >> >> >> its telling me that fields is null :( >> >> >> >> >> >> >> >> help. >> >> >> >> >> >> >> >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >> >> >> >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >> >> >> >> <html xmlns="http://www.w3.org/1999/xhtml"> >> >> >> >> <head> >> >> >> >> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >> /> >> >> >> >> <title>Untitled Document</title> >> >> >> >> <script type="text/javascript"> >> >> >> >> var fields = >> document.getElementById('updateFirmware') >> >> >> >> alert(fields.length); >> >> >> >> </script> >> >> >> >> </head> >> >> >> >> >> >> >> >> <body> >> >> >> >> >> >> >> >> <form name="peripheralForm" action="tony.cfm" >> method="post"> >> >> >> >> Test >> >> >> >> >> >> >> >> <input type="checkbox" id="updateFirmware" /> >> >> >> >> <br /> >> >> >> >> Test >> >> >> >> >> >> >> >> <input type="checkbox" id="updateFirmware" /> >> >> >> >> <br /> >> >> >> >> Test >> >> >> >> >> >> >> >> <input type="checkbox" id="updateFirmware" /> >> >> >> >> <br /> >> >> >> >> Test >> >> >> >> >> >> >> >> <input type="checkbox" id="updateFirmware" /> >> >> >> >> <br /> >> >> >> >> </form> >> >> >> >> >> >> >> >> </body> >> >> >> >> >> >> >> >> </html> >> >> >> >> >> >> >> > >> >> >> > 2 things: >> >> >> > >> >> >> > 1) your <script> is running before the page renders, so there's >> >> nothing >> >> >> > there to report. either put it in a function and call it onload, >> or >> >> run >> >> >> the >> >> >> > <script> at the bottom of the page. >> >> >> > >> >> >> > 2) id is meant to be unique. you won't get an array of values out >> of >> >> >> that. >> >> >> > the browser expects IDs to be unique, and when it sees an element >> >> with a >> >> >> > given ID (via document.getElementById()), it just returns the first >> >> one. >> >> >> > >> >> >> > So... you can try something like this: >> >> >> > >> >> >> > var fields = >> >> >> document.forms['peripheralForm'].getElementsByTagName('input'); >> >> >> > alert(fields.length); >> >> >> > >> >> >> > but of course, that won't give you what you want if there are other >> >> >> elements >> >> >> > in the form. >> >> >> > >> >> >> > could be a job for jQuery and selectors :) >> >> >> > >> >> >> > >> >> >> > >> >> >> > -- >> >> >> > I have failed as much as I have succeeded. But I love my life. I >> love >> >> my >> >> >> > wife. And I wish you my kind of success. >> >> >> > >> >> >> > >> >> >> > >> >> >> >> >> >> >> >> > >> >> > >> >> >> >> >> > >> > >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:287872 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
