IUI document fragments

3 views
Skip to first unread message

anmldr

unread,
Dec 16, 2008, 12:01:29 AM12/16/08
to iPhoneWebDev
I am trying to use iUI but I have a question. On the first page, I
have a long list of names. These names are linked to level 2 pages
that are document fragments. Within these level 2 pages there will be
3 <div>s. I want to be able to use javascript for calculations in one
of these divs. Since these are document fragments, there is no
<head></head> section. Where do I reference or link to the javascript
files for these level 2 pages? Should it all be in the page 1 <head></
head> section?

Thanks,
Linda

Chrilith

unread,
Dec 16, 2008, 4:05:18 AM12/16/08
to iPhoneWebDev
Not sure what you mean but iUI doesn't support javascript code
execution on fragement.
If it is in onclick attribute it will be ok but of course you script
must be in a non AJAX part.
<head> is the right place.

anmldr

unread,
Dec 16, 2008, 9:11:33 AM12/16/08
to iPhoneWebDev
Hmm. I did not know that iUI doesn't support JavaScript. I thought
that it did since it has it's own JavaScript file (iui.js). There are
two places where there will be javascript in the document fragments.
One will be in the OnClick of a "Calculate" and "Clear" button. The
other area though is in preloading images.

Linda

anmldr

unread,
Dec 16, 2008, 9:22:28 AM12/16/08
to iPhoneWebDev
Oh yes, there will be another place. I am also working on a client
side storage of a "Notes" section on each of the second level pages.

So, the app will be:

First page--Long list of drug names.

Tap on one of these and it goes to a document fragment for that
particular drug. This "page" or div section rather, has a list for
the user to choose to go to the information section about the drug or
to choose a section to perform a calculation about the drug or a 3rd
section that has a place for the user to enter notes about the drug.

For the calculation section, I will need to perform a calculation
after the OnClick of a calculate button. I will also have a clear
button. I want to preload some images that will be used for this
section as well.

For the Notes section, I am working on a client side storage of data
that the user enters about that particular drug.

So, my question is if I am using iUI, I need to know where I put a
reference to the javascript for the calculations, preloading images
and for the client side storage of the notes since there is no <head>
section in the 2nd level pages (the ones specific to a particular
drug).

Linda

Justin Milam

unread,
Dec 16, 2008, 9:31:11 AM12/16/08
to iphone...@googlegroups.com
Why not create a JavaScript file with all of the functions you will need
and include it in the head of the index page?

Justin

anmldr

unread,
Dec 16, 2008, 11:52:34 AM12/16/08
to iPhoneWebDev
That is what I wanted to know. Thanks. I wanted to know if it needed
to be in the Index page. It was Chrilith;s comment that "iUI doesn't
support javascript code
execution on fragement" that confused me.

Linda

Chrilith

unread,
Dec 18, 2008, 4:32:45 AM12/18/08
to iPhoneWebDev
Yes, it is only if you want to use <script> tag in fragments.
Of course, onclick events and some others are working fine. And better
if your JS code is already loaded.

brente

unread,
Dec 18, 2008, 8:48:32 PM12/18/08
to iPhoneWebDev
There are two ways I can think of to do what I think you are trying to
do.

1. on the new DIV, just put in a <script>alert('yep');</script>
within the new DIV that you are linking to.

2. a sneaky and undocumented way could also be this: the img tag has
an onload attribute just like the body. use this with a 1x1
transparent pixel shim.
<img src="" border="0" onload="alert('put your func instead of this
alert');"/>

Let me know how that works.

~ brente

anmldr

unread,
Dec 19, 2008, 6:42:45 PM12/19/08
to iPhoneWebDev
That is sneaky ;-)
It will be quite a long time before I give that portion of it a test.
I am not ignoring your answer when I don't follow up on this post. I
have moved on to another portion of the app for awhile and will get
back to this portion later.

Kindest regards,
Linda

waynepan

unread,
Dec 17, 2008, 5:42:49 PM12/17/08
to iPhoneWebDev
I submitted a patch to dynamically execute javascript blocks in
fragments.
http://code.google.com/p/iui/issues/detail?id=102

David Scott

unread,
Dec 21, 2008, 8:58:24 PM12/21/08
to iphone...@googlegroups.com
Dude, you're the man. That has been a useful piece of code for me.

Thanks again,

Dave

David Mark

unread,
Jan 4, 2009, 8:41:17 PM1/4/09
to iPhoneWebDev


On Dec 17 2008, 5:42 pm, waynepan <wayne...@gmail.com> wrote:
> I submitted a patch to dynamically execute javascript blocks in
> fragments.http://code.google.com/p/iui/issues/detail?id=102

Unfortunately, it is drivel. Looks like the rest of this "framework"
is as well, so no real harm done (just avoid it altogether.)

[snip]
Reply all
Reply to author
Forward
0 new messages