iui webkit resize on select

30 views
Skip to first unread message

skip

unread,
Dec 1, 2009, 5:19:21 AM12/1/09
to iPhoneWebDev
We notice a strange behaviour related to window resizing. In our iUI
application we have to deal with some unpredictable formatting coming
from outside data sources. For this reason we set the user-scalable
option to "yes" using the <meta> tag as follows.

<meta name="viewport"
content="width=devicewidth; initial-scale=1.0; maximum-
scale=10.0; minimum-scale=1.0; user-scalable=1;"/>

This works OK and the iUI application runs pretty much as expected
BUT. Have a look at the iUI samples/music program to see the problem
(using the above meta tag). Select the "ThemeSwitcher" option. Click
on the drop down select box. A new pane opens to allow the selection
and the entire screen resizes larger about 40%. I suppose this is OK
but when the selection is complete and the select pane is closed the
resize remains. The user can zoom back down with the pinch gesture
but we want the screen to return to "normal" without user
intervention.

I have tried everything I can think of to either prevent this resize
or to reverse it after the select and have failed dismally. I am not
even sure what code is executing to do this resize. Presumably inside
webkit but I can't find any webkit options that seem to have a bearing
on this. Can anyone suggest a fix? Has anyone else noticed this?
Does anyone else care?

This doesn't happen with Desktop Safari of course only with the iPhone
version.

Thanks,
Skip


Remi Grumeau

unread,
Dec 1, 2009, 9:16:22 AM12/1/09
to iphone...@googlegroups.com
So to recreate the problem, we just have to take the iUI sample and remove this header ?

Remi

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


Remi Grumeau
(+33) 663 687 206
http://www.remi-grumeau.com

skip

unread,
Dec 1, 2009, 3:08:32 PM12/1/09
to iPhoneWebDev
I don't know about removing the <meta> tag completely -- I didn't try
that but I think the viewport definition is required in some form. To
recreate the problem you just have to make a couple of small changes
to the viewport statement in the header as shown in the initial post.
No change to the iUI sample is required.
> > For more options, visit this group athttp://groups.google.com/group/iphonewebdev?hl=en.
>
> Remi Grumeau
> (+33) 663 687 206http://www.remi-grumeau.com
>
>  smime.p7s
> 2KViewDownload

Bontas George

unread,
Dec 2, 2009, 9:01:39 AM12/2/09
to iphone...@googlegroups.com
Hello everybody,

I have another question that keeps me busy!!! I need on loading of some pages to run a javascript! how can this be done!
 example: the javascript is not executed!!! :((
<div id="graph" title="Graph" >
   <fieldset>
        <div class="row">
       
            <table style="width:290px;height:20px; background-color:#FFF">
            <tr>
                <td align="center" bgcolor="#2d3642" style="color:#FFF">50 min</td>
                <td align="center" bgcolor="#2d3642" style="color:#FFF">75 min</td>
                <td align="center" bgcolor="#2d3642" style="color:#FFF">100 min</td>
            </tr>
            </table>
           
            <div id="placeholder" style="width:290px;height:150px; background-color:#000"></div>
   
        </div>
        <div class="row">
        <p>
        <div class="whiteButton"  onclick="graph()">View graph</div>
        </p>
        </div>
    </fieldset>
</div>

<script type="text/javascript">
$(document).ready(function(){
    var d1 = [];
    for (var i = 0; i < 14; i += 0.5)
        d1.push([i, Math.sin(i)]);

    var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];

    // a null signifies separate line segments
    var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
   
    $.plot($("#placeholder"), [ d1, d2, d3 ]);
});


Niels Leenheer

unread,
Dec 2, 2009, 9:40:49 AM12/2/09
to iphone...@googlegroups.com
Are you loading these pages using iUI or jQuery?

If so you need to change the Javascript, because the jQuery only triggers $(document).ready() when the main page is loaded, not when individual HTML fragments are inserted using AJAX. Try removing the $(document).ready() from around your script and see if that works.

Cheers,

Niels Leenheer


Bontas George

unread,
Dec 2, 2009, 11:23:20 AM12/2/09
to iphone...@googlegroups.com
Hello Niels,

Sorry but it does not work with/without $(document).ready(!!! don't know why! If I try with Mozilla Firefox it works if I put a delay(if I don't put i have the error because the div placeholder is not loaded fully and does not detect param.) but not Safari! I think there should be a trick behind!

Thanks


From: Niels Leenheer <niels.l...@gmail.com>
To: iphone...@googlegroups.com
Sent: Wed, December 2, 2009 4:40:49 PM
Subject: Re: javascript execution

skip

unread,
Dec 3, 2009, 4:28:36 AM12/3/09
to iPhoneWebDev
This thread was initially about iPhone screen resizing during drop
down selects. You have hijacked the thread to discuss execution of
Javascript in fragments, and also changed the title of the thread. At
the very least this is unhelpful. If you promise not to hijack
anymore discussion threads I will tell you how to make javascripts
execute when fragments are loaded - we do it all the time.

You haven't helped me to solve my problem at all.

Skip

Bontas George

unread,
Dec 3, 2009, 8:25:22 AM12/3/09
to iphone...@googlegroups.com
Running on iUI and this gives me headaches. Because on many pages I need to run script just after all html code is loaded!!!
I have now ananother issue with cookies!!! CANNOT set cookies from php after some HTML HAS ALREADY LOADED. So now it's needed to run from javascript and I don't know how to start the script directly when the page is fully loaded!!!

can anybody answer this question??

10x


From: Niels Leenheer <niels.l...@gmail.com>
To: iphone...@googlegroups.com
Sent: Wed, December 2, 2009 4:40:49 PM
Subject: Re: javascript execution

Bontas George

unread,
Dec 3, 2009, 9:14:16 AM12/3/09
to iphone...@googlegroups.com
Sorry skip!!! I has not attentive and did not knew about this issue!! I'll be more attentive regarding hijacking!!! :p

But if you can help I badly need it!!! this fragments are really killing me slowly.

10x and sorry again,

George


From: skip <ski...@ozemail.com.au>
To: iPhoneWebDev <iphone...@googlegroups.com>
Sent: Thu, December 3, 2009 11:28:36 AM
Subject: Re: javascript execution
--

You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
To post to this group, send email to iphone...@googlegroups.com.
To unsubscribe from this group, send email to iphonewebdev+unsub...@googlegroups.com.

skip

unread,
Dec 3, 2009, 4:11:16 PM12/3/09
to iPhoneWebDev
If you want JavaScript code to execute when fragments are loaded into
a framework such as iUI here is how we do it.

First, make sure you are using the "latest" (at least v 0.40-dev1)
version of iUI which has dispatchEvent hooks built into it.

Next create a little javascript file for your custom use in your
project (say it is myproject.js).

Here is an extracted snippet from our custom project file which
contains just the code required to do the "script execution"

<CODE> /* This would be your myproject.js */

/* Special scripts for the Mediweb iPhone project
* wrh Nov 2009 - SVMHS
* St. Vincents and Mater Health Sydney
*/

(function () {
addEventListener("load", function(event)
{
document.body.addEventListener('beforeinsert', beforeFragmentInsert,
false);
}, false);
})(); // End of the self-executing function that loads the event
handlers


//This is the event handler for "beforeinsert" event in iUI
function beforeFragmentInsert(event) {

// if we find any inline scripts - execute them
var f = event['fragment'];
if (f.tagName.toLowerCase() == "script") // check the root of the
fragment
eval(f.innerHTML);

var n = f.getElementsByTagName("script"); // and any elements below
the root
for (z=0; n && z<n.length;z++)
{
eval(n[z].innerHTML);
f.removeChild(n[z]); // prevent the script from flashing on
the screen
}
}


/* This would be the end of the myproject.js snippet */</CODE>



Now in the <head> element of the first HTML page of your iUI project
add the following line as the last js declaration:

<script type=\"application/javascript\" src=\"myproject.js\"></script>


Now you will find that any <script> elements contained in the fragment
will execute after your fragment has been downloaded by Ajax and
before it is actually inserted into the displayable document. If you
want it after the insert into the document there would be a couple of
small changes required.

Good luck,
Skip


















/* Special scripts for the Mediweb iPhone project
* wrh Nov 2009 - SVMHS
* St. Vincents and Mater Health Sydney
*/

(function () {
addEventListener("load", function(event)
{
document.body.addEventListener('beforeinsert', beforeFragmentInsert,
false);
}, false);
})(); // End of the self-executing function that loads the event
handlers


//This is the event handler for "beforeinsert" event in iUI
function beforeFragmentInsert(event) {

// if we find any inline scripts - execute them
var f = event['fragment'];
if (f.tagName.toLowerCase() == "script") // check the root of the
fragment
eval(f.innerHTML);

var n = f.getElementsByTagName("script"); // and any elements below
the root
for (z=0; n && z<n.length;z++)
{
eval(n[z].innerHTML);
f.removeChild(n[z]); // prevent the script from flashing on
the screen
}



On Dec 4, 1:14 am, Bontas George <bontas_george2...@yahoo.com> wrote:
> Sorry skip!!! I has not attentive and did not knew about this issue!! I'll be more attentive regarding hijacking!!! :p
>
> But if you can help I badly need it!!! this fragments are really killing me slowly.
>
> 10x and sorry again,
>
> George
>
> ________________________________
> From: skip <skip...@ozemail.com.au>
> To unsubscribe from this group, send email to iphonewebdev...@googlegroups.com.

Remi Grumeau

unread,
Dec 3, 2009, 4:30:34 PM12/3/09
to iphone...@googlegroups.com

Now in the <head> element of the first HTML page of your iUI project
add the following line as the last js declaration:

<script type=\"application/javascript\" src=\"myproject.js\"></script>

Which is actually the whole point … i'd rather say "issue".
Let's imagine i have a webapp with a products list with bunch of JS, a store locator using Google Maps, … and GA for analytics.
A visitor which is not using the Map section will download the whole Maps Javascript for nothing.

In this example case, that's not too bad … but for a biggest website / webapp, this could be a real first load timing issue.
Am i wrong ?
The only solution then would be to use a non-sliding target _blank link ?

Remi

skip

unread,
Dec 3, 2009, 5:10:48 PM12/3/09
to iPhoneWebDev
I'm not sure I follow the problem Remi.

If you are suggesting that it is possible to jump into the middle of
the app without loading the surrounding framework including iui.js,
iui.css etc then that would trash the whole app.

If you are suggesting the path to the custom.js file might be obscure
then it can be made as "fully qualified" as iui.js itself - whatever
that is.

If you are suggesting there is wasted bandwidth and unnecessary
downloaded code I can only say that in our case the "execute
javascript element" code is pretty short and is executed on a very
frequent basis. The app is entirely internal to our site so it is
only accessed by wi-fi at present and bandwidth is the least of our
problems.

Don't forget the end-user is not downloading the entire functional
javascript at the <head> of the application - he is just downloading
the little snippet that parses the fragment, extracts the eventual
javascript for the new page, and executes it. The page specific js is
downloaded with the page to which it applies and is not transmitted if
it is not needed.

In any case I am just reporting what we actually do in a production
application and so far it has not produced any grief. If anybody else
finds it useful - good for them.

Skip
>  smime.p7s
> 2KViewDownload

Remi Grumeau

unread,
Dec 3, 2009, 5:25:05 PM12/3/09
to iphone...@googlegroups.com
If bandwidth and unnecessary code download is not your problem, then this is ok for you / your application.

But it's not for me. The Google Maps javascript should only be downloaded and parsed by the browser only if and when i decide to.

> --
>
> You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
> To post to this group, send email to iphone...@googlegroups.com.
> To unsubscribe from this group, send email to iphonewebdev...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.

skip

unread,
Dec 3, 2009, 6:20:25 PM12/3/09
to iPhoneWebDev
I guess I don't understand your app Remi. I am almost certain you
aren't following what I am saying either. I don't suggest the Google
Maps javascript should be downloaded and parsed at the <head> of the
document. Our code would not do that. If your "Maps" javascript is
included in a "Maps" page fragment it would be downloaded, parsed and
executed at the time the "Maps" page loaded. If you mean that you
want to control the time of execution according to user action in the
middle of the page - we use a separate technique to do this. We have
customized the various forms of the "Submit" event to enable special
form processing but the original poster did not ask about that.

Unnecessary code download is always everybody's problem. It's 738
bytes including comments ( wouldn't be any bigger for "Google Maps") ,
it's used all the time and we just don't think it is unnecessary.

Cheers,
Skip
> > For more options, visit this group athttp://groups.google.com/group/iphonewebdev?hl=en.
>
> Remi Grumeau
> (+33) 663 687 206http://www.remi-grumeau.com
>
> smime.p7s
> 2KViewDownload

Bontas George

unread,
Dec 4, 2009, 2:51:55 AM12/4/09
to iphone...@googlegroups.com
Hi Skip,

Good idea, but I am not so pro with javascript and general web applications (first project). So when I put your code in the .js file I was surprised to see that there are errors. First one is here

(function () {
addEventListener("load", function(event)
{
document.body.addEventListener('beforeinsert', beforeFragmentInsert,
false);
}, false); //at this line and says that a bracket } is needed. everything good because I deleted the ; and error wasn't there anymore!
})();

Ok now the error is at this line:  var f = event['fragment']; ----- and this is not normal because it is correct!!! what I've seen is that if I remove the <CODE> tags everything is working nicely... I really would like to know what is the issue!!

And something else too in the HTML:
why so: <script type=\"application/javascript\" src=\"myproject.js\"></script>
and not so: <script type="application/javascript" src="myproject.js"></script>
because the first one is killing the tags in my source... I think so...

If you have the time to give me short points to this or what to look for cause I googled a little bit but I'm not on the correct path!

Thanks,
George

From: skip <ski...@ozemail.com.au>
To: iPhoneWebDev <iphone...@googlegroups.com>
Sent: Thu, December 3, 2009 11:11:16 PM
Subject: Re: javascript execution
> To unsubscribe from this group, send email to iphonewebdev+unsub...@googlegroups.com.

> For more options, visit this group athttp://groups.google.com/group/iphonewebdev?hl=en.

--

You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
To post to this group, send email to iphone...@googlegroups.com.
To unsubscribe from this group, send email to iphonewebdev+unsub...@googlegroups.com.

Remi Grumeau

unread,
Dec 4, 2009, 6:34:05 AM12/4/09
to iphone...@googlegroups.com
:)
I totally understand the fact that for you it is not a problem. 738 bytes is definitely not a problem.
But since the <head> is never reloaded if you're using slides, you can't only load the iUI.js and, only when maps.php is loading, download the maps.js.

Remi

> For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.

skip

unread,
Dec 4, 2009, 3:58:43 AM12/4/09
to iPhoneWebDev
I'll try to work through this from the end to the beginning George.

1.) Yes the escapes for the quotations are because I cut the code out
of our PHP generator. If you are typing the code directly into the
HTML they are not needed - indeed wrong.

2.) The <CODE> tags are simply for pasting into bulletin boards such
as this Google group to prevent the BB software altering the source
code. The <CODE> doesn't belong in the application itself.

3.) As for the part that installs the EventListener I don't quite
follow the problem. I cut your code out of your reply and pasted it
straight into our application and it gave no error, and in fact ran
our embedded scripts OK. I see no missing braces or extra ; Perhaps
you could post the entire myproject.js script if it is not too long
and I will try running it verbatim. What browser are you running this
on - iPhone Safari?



On Dec 4, 6:51 pm, Bontas George <bontas_george2...@yahoo.com> wrote:
> Hi Skip,
>
> Good idea, but I am not so pro with javascript and general web applications (first project). So when I put your code in the .js file I was surprised to see that there are errors. First one is here
> (function () {
> addEventListener("load", function(event)
> {
> document.body.addEventListener('beforeinsert', beforeFragmentInsert,
> false);
>
> }, false); //at this line and says that a bracket } is needed. everything good because I deleted the ; and error wasn't there anymore!
> })();
>
> Ok now the error is at this line:  var f = event['fragment']; ----- and this is not normal because it is correct!!! what I've seen is that if I remove the <CODE> tags everything is working nicely... I really would like to know what is the issue!!
>
> And something else too in the HTML:
> why so: <script type=\"application/javascript\" src=\"myproject.js\"></script>
> and not so: <script type="application/javascript" src="myproject.js"></script>
> because the first one is killing the tags in my source... I think so...
>
> If you have the time to give me short points to this or what to look for cause I googled a little bit but I'm not on the correct path!
>
> Thanks,
> George
>
> ________________________________
> > To unsubscribe from this group, send email to iphonewebdev...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/iphonewebdev?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
> To post to this group, send email to iphone...@googlegroups.com.
> To unsubscribe from this group, send email to iphonewebdev...@googlegroups.com.

Bontas George

unread,
Dec 4, 2009, 4:46:08 AM12/4/09
to iphone...@googlegroups.com
Dear Skip,

everything works good I found out... no more <code> tags and the html : <script type="application/javascript" src="myproject.js"></script>

but I've seen that all inner text of the javascript tag is surrounded by quotes so is nothing to execute... why?? is this done automatically by the iui.js or something else??

10x


From: Bontas George <bontas_g...@yahoo.com>
To: iphone...@googlegroups.com
Sent: Fri, December 4, 2009 9:51:55 AM
Subject: Re: javascript execution
To unsubscribe from this group, send email to iphonewebdev...@googlegroups.com.

skip

unread,
Dec 4, 2009, 3:31:27 PM12/4/09
to iPhoneWebDev
We are getting so many "quoted replies" stacked together here I have
trouble following the thread. Please don't include any previous stuff
George.

There should not be any quotes around the innerHTML in the <script>
tags. I have just checked ours and there are none there. Try
creating a simple <script> such as just an alert message. Perhaps the
process that generates the script is putting the quotes there. This
is getting a bit complex for a discussion group. If you want to email
me your myproject.js file directly to skiphod1 (at) hotmail.com I
will have a look. Tell me how the <script> tag is being generated and
what you think it contains. I will try to suggest some debugging once
I see the script. What browser are you using - iPhone Safari? What
version of iUI?

Skip

skip

unread,
Dec 4, 2009, 3:46:27 PM12/4/09
to iPhoneWebDev
Thanks for giving this so much consideration Remi. I can see you are
busy judging by the number of replies you give to everybody else and
the fact that you mentioned you are changing jobs.

The fact is that the <head> doesn't need to be reloaded to download
the maps.php or the maps.js. The little script in the <head> is
loaded as an eventListener and just sits there forever waiting for you
to later load maps.php. When you do so the 738 byte eventListener
springs into action and executes your "huge" <script> which is
embedded in your maps.php page. I don't know maps.js but I assume it
can be embedded entirely in the maps.php page inside a <script> tag??
The code we use does not access a separate .js file so if the maps
javascript won't/can't be contained in the maps.php page - You're
right this is not useful to you. It could certainly be modified to
download a separate .js file but then it would be bigger than 738
bytes!

Again thanks for the input.
Skip

Remi Grumeau

unread,
Dec 4, 2009, 5:12:18 PM12/4/09
to iphone...@googlegroups.com

Le 4 déc. 2009 à 21:46, skip a écrit :

> Thanks for giving this so much consideration Remi. I can see you are
> busy judging by the number of replies you give to everybody else and
> the fact that you mentioned you are changing jobs.

humm … AFAIK, i only mention it twice, when people asked me if i have time to help them further :-/
But I don't really see the point here. If you think my answers are not appropriate, feel free to answer back mail by mail, point by point.
And if you have a personnal problem with me or with what i do, drop me an email but i don't really see the point for a mailing list entry

> The fact is that the <head> doesn't need to be reloaded to download
> the maps.php or the maps.js. The little script in the <head> is
> loaded as an eventListener and just sits there forever waiting for you
> to later load maps.php. When you do so the 738 byte eventListener
> springs into action and executes your "huge" <script> which is
> embedded in your maps.php page. I don't know maps.js but I assume it
> can be embedded entirely in the maps.php page inside a <script> tag??

Sure, that's the whole point.

> The code we use does not access a separate .js file so if the maps
> javascript won't/can't be contained in the maps.php page - You're
> right this is not useful to you. It could certainly be modified to
> download a separate .js file but then it would be bigger than 738
> bytes!
>
> Again thanks for the input.
> Skip
>
>
> On Dec 4, 10:34 pm, Remi Grumeau <remi.grum...@gmail.com> wrote:
>> :)
>> I totally understand the fact that for you it is not a problem. 738 bytes is definitely not a problem.
>> But since the <head> is never reloaded if you're using slides, you can't only load the iUI.js and, only when maps.php is loading, download the maps.js.
>>
>> Remi
>>
>

skip

unread,
Dec 4, 2009, 6:19:43 PM12/4/09
to iPhoneWebDev
Deepest apologies Remi. I meant no offense whatsoever. I am
immensely grateful for your time and contribution.
I guess I was just being a bit too "chatty" for such a forum.
Keep up the good work.
Skip

Sean Gilligan

unread,
Dec 4, 2009, 6:32:36 PM12/4/09
to iphone...@googlegroups.com
skip wrote:
> Remi ...
>
> I am immensely grateful for your time and contribution.
>

So am I. Thanks, Remi and everyone else whose been helping to support
iUI and use iUI on this list.

-- Sean

Remi Grumeau

unread,
Dec 4, 2009, 8:03:18 PM12/4/09
to iphone...@googlegroups.com
seems a missunderstanding to me too
happy to know we're good then :)

sorry if i'be been too 'chatty', english is not my native language so probably have been over reacting somehow

remi

Dan

unread,
Jan 25, 2010, 10:56:46 PM1/25/10
to iPhoneWebDev
Are there any samples of javascript execution in a web site using iUI?
I used the code above in this thread, and it works fine when using my
desktop Firefox with a user agent to spoof iPhone 3.0, but when I use
Mobile Safari on my iPhone, the script doesn't execute. I know the
script is there and that the beforeinsert is working by putting an
alert in the beforeInsertFragement method. Any other thoughts,
examples, or pointers for debugging would be much appreciated.

Remi Grumeau

unread,
Jan 26, 2010, 2:01:12 AM1/26/10
to iphone...@googlegroups.com
have you tried the Safari debugging mode on the iphone ?

Remi

Dan

unread,
Jan 26, 2010, 10:31:22 AM1/26/10
to iPhoneWebDev
On Jan 26, 1:01 am, Remi Grumeau <remi.grum...@gmail.com> wrote:
> have you tried the Safari debugging mode on the iphone ?
>
Remi,

Thank you! That is really a nice little option that I hadn't seen
before. It is reporting a javascript error in the console:
TypeError: Result of expression 'document.forms[0]' [undefined] is not
an object.

I used the javascript code for hooking the beforeinsert as posted
above. I have something like this going on in my html page:
<form id="log" action="postit" method="post">
<input id="EntryDate" />
<input id="Amount" />
<input type="submit" />
</form>

<script>document.forms[0].Amount.focus();</script>

I'm actually trying to set the EntryDate to today's date, too, but the
above should help show the problem easily without adding another js
function to do that.

Again, this works fine on Firefox on my desktop, but results in the
above error on Mobile Safari on the iPhone. Any further ideas?

Thanks again.

Dan

skip

unread,
Jan 26, 2010, 4:38:53 PM1/26/10
to iPhoneWebDev
Dan, the code that was pasted above comes from a working application.
George, above, got it to work too with a bit
of offline help. He also used the afterInsert method. Show us what
script you are trying to run and how you are trying to run it.

Skip

skip

unread,
Jan 27, 2010, 1:57:54 AM1/27/10
to iPhoneWebDev
Alright Dan, the problem is almost certainly this. You have to
consider WHEN the script will run as well as what the contents of the
script are. This was a problem with another user as well. Hooking
the "beforeinsert" event means that the script will run after the page
has been downloaded by Ajax and before it has been inserted into the
DOM which is displayed. I doubt that is what you meant to do. At
this point in time the "form" is not part of the Document so of course
the reference to it is undefined. I get the impression (from the
location of the <script> tag in your example) that you want it to run
after the "form" has been inserted into the DOM and possibly after the
user has entered some data in the form and is submitting the form.
Either of these can be done but you have to let us know what you are
trying to do here. The location of the <script> tag in the code has
nothing to do with WHEN the script will be run.

Skip


George Bontas

unread,
Feb 10, 2010, 4:43:13 AM2/10/10
to iphone...@googlegroups.com

Hello everybody,

I have an issue: I am trying to use a jquery chart creator – flot!

I get an error because when I want to try the software. But if I execute at console the function after everything loaded it works. Seems like not everything is really loaded or so!

I even did some changes on the iui.js at function updatePage(page, fromPage) at the end I add the load part to run the script. Here I get a different error saying that the function $.flot does not exist! This is curios cause otherwise it works.

 

In attach I put the project!

Thank you in advance!

By the way! I cannot put Flot.html in the index.html because it’s going to be flot.php and the data for the chart are retrieved from a sqldatabase!

 

George


flot.rar

Andy Fuchs

unread,
Feb 10, 2010, 10:39:55 AM2/10/10
to iphone...@googlegroups.com
I dunno what you sent, but if take the index.html and remove the link to
'load.js', everything works fine...

a.

Bontas George

unread,
Feb 10, 2010, 10:51:56 AM2/10/10
to iphone...@googlegroups.com
for me doesn't! you are saying in the second part when chart button is pressed the new loaded fragment has the chart???

or maibe you have an iui.js modified and taken lolcaly??

btw I am using MobiOne for testing!

thank you!
George
.


From: Andy Fuchs <an...@elgato.com>
To: "iphone...@googlegroups.com" <iphone...@googlegroups.com>
Sent: Wed, February 10, 2010 5:39:55 PM
Subject: Re: javascript execution
--
You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
To post to this group, send email to iphone...@googlegroups.com.
To unsubscribe from this group, send email to iphonewebdev+unsub...@googlegroups.com.

Andy Fuchs

unread,
Feb 10, 2010, 11:22:07 AM2/10/10
to iphone...@googlegroups.com
Well - as long as you don't post a complete example, it's hard to say what
the difference is.

Just a hint: Put it somewhere on the web instead of sending an incomplete
sample. That makes finding the problem way easier.

a.

Bontas George

unread,
Feb 11, 2010, 2:33:03 AM2/11/10
to iphone...@googlegroups.com
Hi Andy,

The example is complete. I just put on index the chart to see that it works when is first loaded but when loaded from another file Flot.html (when chart button pressed the Flot.html is loaded) it doesn't!
I listened to your proposal and I put it also on a server:
http://symbolmedia.ro/zattaro/flot/

this is the link! If you can help me I would appreciate it! If it works let me know with what you tested it because maybe my MobiOne 1.0M6 is not working properly.

Thanks,
George

Sent: Wed, February 10, 2010 6:22:07 PM
Subject: Re: javascript execution

Bontas George

unread,
Mar 1, 2010, 9:25:03 AM3/1/10
to iphone...@googlegroups.com
Hello everybody,

I have a question. I just put a picture inside a div at real size and I want to move that picture inside that div. I used the code:

         makeObjectMovable(picture);
       
        document.addEventListener("
touchstart", startmove, false);

        document.addEventListener("touchmove", move, false);

        document.addEventListener("touchend", endmove, false);

and so the picture moves inside the div. But I am using iUI and so the touch handler is now broken. everything related to buttons scrolling into page.. are not working.

So I was hoping you can give me an idea how to make this. Or just to find the eventhandlers from iUI to change there with an if (if object movable move it inside div and if not to do the rest!)

My issue comes because in the MobiOne simultor the project works but on iPhone does not!

Thank you!
George

Reply all
Reply to author
Forward
0 new messages