Jump to content

Search the Community

Showing results for tags 'flow of code error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 1 result

  1. hi all! first let me be clear - the ajax skeletal of the script is not the issue here. I have been working through night to ensure those portions are all functioning properly. i successfully load an xml document with the value of selected for each service, eiter displayed as selected or a blank string. however - when i attempt to select the selected service (in memory) in the dropdown after refreshing the xml, it selects nothing... could an bright sparks perhaps assist me in locating and resolving the issue? below is the relevant javascript portions: // parse services xml (this works perfectly so please do not think it is at fault if "unable to see the forest for the lemons") var services = xmldoc.getElementsByTagName("service"); var arr10 = new Array(); servicearr = new Array(); for (var x = 0; x < services.length; x++) { if (services[x].attributes.getNamedItem("sid") && services[x].attributes.getNamedItem("desc") && services[x].attributes.getNamedItem("selected") && indexOf.call(servicearr,services[x].attributes.getNamedItem("sid").nodeValue)==-1) { var arr = new Array(); var aa = 0; var arr1 = new Array(); arr[0] = services[x].attributes.getNamedItem("sid").nodeValue; arr[1] = services[x].attributes.getNamedItem("desc").nodeValue; arr[2] = services[x].attributes.getNamedItem("selected").nodeValue; var i = 1; for (var c = 0; c < services[x].childNodes.length; c++) { if (services[x].childNodes[c].nodeName == "attribute" && services[x].childNodes[c].attributes.getNamedItem("id").nodeValue != undefined) { var arr2 = new Array(); arr2[0] = services[x].childNodes[c].attributes.getNamedItem("id").nodeValue; arr2[1] = services[x].childNodes[c].attributes.getNamedItem("desc").nodeValue; arr2[2] = services[x].childNodes[c].attributes.getNamedItem("val").nodeValue; arr2[3] = services[x].childNodes[c].attributes.getNamedItem("ord").nodeValue; arr2[4] = (services[x].childNodes[c].attributes.getNamedItem("ptr").nodeValue!="")?services[x].childNodes[c].attributes.getNamedItem("ptr").nodeValue:""; arr1[aa] = arr2.join(";;;"); aa++; } } arr[3] = arr1.join(";.;"); // service attributes //salert(arr); if (arr.length) { addrecord("menu_services", arr); servicearr.push(arr[0]); svc = true; } } } // single addrecord function function addrecord(id, arr) { salert(id); salert(arr[0]); salert(arr[1]); salert(arr[2]); var opt0 = document.createElement("option"); //salert(arr[i]); opt0.text = arr[1]; // value 1 text service name opt0.value = arr[0] + "|;|" + // value 0 service id arr[2] + "|;|" + // save selection flag ("selected" or "") arr[3]; // save the value 3 attribute keys/values/order array string opt0.selected = (arr[2]=="selected")?true:false; var sel = document.getElementById(id); try { sel.add(opt0, null); // standards compliant; doesn't work in IE } catch(ex) { sel.add(opt0); // IE only } if (arr[2] == "selected") { sid = arr[0]; // save sid if selected! //sel.selectedIndex = sel.options.length-1; } } to prove that the xml loads correctly - here is an excerpt with the Bakky Canopy service... <root> <service sid="10" desc="Accounting Bookkeeping" selected="">...</service> <service sid="1" desc="Bakkie Canopy" selected="selected">...</service> <service sid="3" desc="Bakkie Canopy Accessories" selected=""></service> <service sid="2" desc="Bakkie Linings & Rubberizing" selected=""></service> <service sid="15" desc="Broadband Internet" selected="">...</service> <service sid="5" desc="Business Phone Systems" selected="">...</service> <service sid="9" desc="Company Registrations" selected="">...</service> <service sid="11" desc="Conference Venues" selected="">...</service> <service sid="8" desc="Debt Collection Agencies" selected="">...</service> <service sid="17" desc="Office Coffee" selected="">...</service> <service sid="7" desc="Office Colour Printers" selected="">...</service> <service sid="12" desc="Office Furniture" selected="">...</service> <service sid="13" desc="Office Movers" selected="">...</service> <service sid="14" desc="Office Network Cabling" selected="">...</service> <service sid="6" desc="Office Printers & Copiers" selected="">...</service> <service sid="16" desc="Office Water" selected="">...</service> <service sid="4" desc="Placeholder" selected=""></service> <sql/> </root> as can be seen in the xml and javascript - the service id 1 should load as default selected service id... i am hereby requesting javascripters with great insightto see what i do not - the services all load, but none are selected in the html web form. many thanks in advance to the one (or more) whom with crystal clarity, can resolve this. sincerely - Pierre "Greywacke" du Toit
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.