Needing some javascript builded charts in generated form, I have added
in iui.js the extra code which extend the ability for iui to evaluate
inserted code in <script> tag.
The path to access the javascript component exists in the main form
But it still don't work, am I missing something ?
The page is inserted and is fine but the javascript generated graph
are not displayed

(the *** marks have been aded for information purpose they are not in
the real source

insertPages: function(nodes)
    {
        var targetPage;
        for (var i = 0; i < nodes.length; ++i)
        {
            var child = nodes[i];
**** new code under ***
            if (child.tagName && child.tagName.toLowerCase() ==
"script")
            {
                javascript:eval(child.innerHTML);
            }
****
            else if (child.nodeType == 1)
            {
                if (!child.id)
                    child.id = "__" + (++newPageCount) + "__";
                var clone = $(child.id);
                if (clone)
                    clone.parentNode.replaceChild(child, clone);
                else
                    document.body.appendChild(child);
                if (child.getAttribute("selected") == "true" || !
targetPage)
                    targetPage = child;
                --i;
            }
        }
       if (targetPage)
            iui.showPage(targetPage);
    },



Example of page creation


<?php

   echo '<form id="indicators" class="panel" title="My Indicators">';
        echo '<h2>2009 Monthly sales</h2>';
        echo '<fieldset>';
        echo '<div id="graph1">loading graph...</div>';
   echo '<div>';
        echo '<script type="application/x-javascript">';
        echo '  var myData = new Array(["01", 210], ["02", 300], ["03", 280],
["04", 200], ["05", 120], ["06", 325], ["07", 250], ["08", 2]);';
        echo '  var myChart = new JSChart("graph1", "bar");';
        echo '  myChart.setDataArray(myData);';
        echo '  myChart.setTitle("");';
        echo '  myChart.setAxisNameY("");';
        echo '  myChart.setAxisNameX("");';
        echo '  myChart.setSize(300, 220); ';
        echo '  myChart.draw(); ';
        echo '</script>';
   echo '</div>';
        echo '</fieldset> ';
        echo '<h2>Top Destinations</h2> ';
...

The php generated code above works if it is hard typed in the main IUI
page (accessed using a #)

TIA
Joel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to