i got it to work. (it's cobbled together)

ok here's the run down for those interested....
the form has text fields check boxes and radio buttons.
so when successful here's the function...

-----------------------------------------------------------------------------------------------

        var root = o.responseXML.documentElement;
        nodelist = root.childNodes
        for(i = 0; i < nodelist.length; i++) {
                temp = '';
                currentNode = nodelist[i].nodeName;
                temp=nodelist[i].firstChild;
                if (temp!=null) {
                        /* case for number values */
                        currentNodeTemp = nodelist[i].nodeName +
nodelist[i].firstChild.nodeValue; /* get value of node */
                        currentValue =  nodelist[i].firstChild.nodeValue; /* 
get name of node */
                        switch (currentValue){ /* do the right thing */
                        case (currentValue = "1"): /* for radio buttons */
                                oForm[currentNodeTemp].checked = true;
                        break
                        case (currentValue = "2"):
                                oForm[currentNodeTemp].checked = true;
                        break
                        case (currentValue = "3"):
                                oForm[currentNodeTemp].checked = true;
                        break
                        case (currentValue = "4"):
                                oForm[currentNodeTemp].checked = true;
                        break
                        case (currentValue = "5"):
                                oForm[currentNodeTemp].checked = true;
                        break
                        /* for true false*/ /* for check boxes and 'yes - 
no'radio button*/
                        case (currentValue = "True"):
                                oForm[currentNode].checked = true;
                        break
                        case (currentValue = "False"):
                                oForm[currentNode].checked = false;
                                LastUnderscore = currentNode.lastIndexOf ('_',
currentNode.length-1) /* yes no radio button have id_Yes or id_No */
                                if LastUnderscore > 0 ){ /* so if it has an 
underscore the id_No
needs to be checked 'true' because if checked 'false' it wouldn't be
selected */
                                        oForm[currentNode].checked = true;
                                }
                        break
                        default:
                                oForm[currentNode].value = 
nodelist[i].firstChild.nodeValue; /*
fills text input wit text */
                        }
                }
-----------------------------------------------------------------------------------------------

and if you can follow that cool.
when this goes live I can show it for those interested.

John I


On 2/16/07, Sravan kumar <[EMAIL PROTECTED]> wrote:
Hi John,

I haven't really done lot of parsing using javascript but here is a link
which has lot of examples (one of them related to your request... auto
complete)

http://www.dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-list

I haven't really gone through lot of the stuff out there due to time
constraint but i think it definitely gets you few ideas.

Best of luck...

Thanks
Sravan


>From: "John Ivanoff" <[EMAIL PROTECTED]>
>Reply-To: Dallas/Fort Worth ColdFusion User Group Mailing
>List<[email protected]>
>To: "dfw cfug" <[email protected]>
>Subject: [DFW CFUG] JavaScript help
>Date: Mon, 12 Feb 2007 17:38:27 -0600
>
>I am not JavaScript guru and I am hacking here...
>
>I have a script that read a XML doc.
>The script reads the node names of the first nodes
>fname, lname....
>If I use the variable tempNode it does not work (nothing is written to
>the div.innerHTML).
>if I use the variable teporName it give me the last name for all the
>node (which I expected) so I am doing something wrong here. Any Ideas?
>I've been searching Google all day.
>
>background on what I am doing...
>its for a form for a conference...
>If I type in my first name, last name and company I will get info from
>a db and populate the form for them. but if there are nodes that are
>empty I need to set them to "" (a empty string) or the form won't
>populate. (or I need to ship the empty node)
>So I need to read the node, see if it has a value and if it does put
>the value into the form. if it is empty skip it.
>
>thanks in advance
>
>John
>
>
>script................................
>
>       var root = o.responseXML.documentElement;
>       nodelist = root.childNodes
>       words = '';
>       for(i = 0; i < nodelist.length; i++) {
>               tempNode = nodelist[i].nodeName;
>               teporName = 'lname';
>               tempValue = 
root.getElementsByTagName(teporName)[0].firstChild.nodeValue;
>               /*tempValue =
>root.getElementsByTagName(teporName)[0].firstChild.nodeValue;*/
>               words += i + ' ' + tempNode + ' | value = ' + tempValue + '<br 
/>';
>       }
>               words += ' done.';
>       div.innerHTML = words;
>
>xml.............................
>|
><person>
>     <fname>Tracy</fname>
>     <lname>allman</lname>
><address1/>
><address2/>
><city_town>Plano</city_town>
><county>TX</county>
></person>
>
>_______________________________________________
>Reply to DFWCFUG:  [email protected]
>Subscribe/Unsubscribe:
>http://lists1.safesecureweb.com/mailman/listinfo/list
>List Archives:    http://www.mail-archive.com/list%40list.dfwcfug.org/
>         http://www.mail-archive.com/list%40dfwcfug.org/
>DFWCFUG Sponsors:  www.HostMySite.com  www.teksystems.com/

_________________________________________________________________
Find a local pizza place, movie theater, and more….then map the best route!
http://maps.live.com/?icid=hmtag1&FORM=MGAC01


_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.HostMySite.com 
  www.teksystems.com/

Reply via email to