iUi toolbar buttons

6 views
Skip to first unread message

BikePilgrim

unread,
Aug 13, 2007, 9:50:59 PM8/13/07
to iPhoneWebDev
I'm using iUI to build an app. Going off of the examples provided on
the website, I put a blue button in the top right corner of the
toolbar. When I visit other pages which are loaded via ajax I'd like
to change the function of that button. Can anyone think of a clean way
to do this from an ajax loaded page?

Mobivity

unread,
Aug 14, 2007, 11:17:01 AM8/14/07
to iPhoneWebDev
I made a change to the iUi to handle this. I needed to hide the button
as well.

I added these attributes

hideToolbarButton
toolbarButtonText
toolbarButtonHREF

Works perfectly. Just put the attributes in your Form or Div or UL tag
for the page. Make sure you actually create the button though. This
only changes it.

<ul id="Welcome" title="iPheedr" toolbarButtonText="Settings"
toolbarButtonHREF="prefs.aspx">

Then I added this in the UpdatePage routine:

// @@ Added on 8/1 by gh - change ToolBar button
var toolbarButton = $("toolbarButton");
if (toolbarButton)
{
if (!page.getAttribute("hideToolbarButton"))
toolbarButton.style.display = "inline";
else
toolbarButton.style.display = "none";

if (page.getAttribute("toolbarButtonText"))
toolbarButton.innerHTML =
page.getAttribute("toolbarButtonText")

if (page.getAttribute("toolbarButtonHREF"))

toolbarButton.setAttribute("href",page.getAttribute("toolbarButtonHREF"));

if (page.getAttribute("toolbarButtonType"))

toolbarButton.setAttribute("type",page.getAttribute("toolbarButtonType"));

}
// *******


Works great. Hope this helps. I struggled for a while before deciding
to hack the iui.js file.

BikePilgrim

unread,
Aug 14, 2007, 3:17:39 PM8/14/07
to iPhoneWebDev
Perfect, and very elegantly done. Cheers!

BikePilgrim

unread,
Aug 14, 2007, 3:54:34 PM8/14/07
to iPhoneWebDev
Any idea how to make the toolbarButton submit a form on the page? I
tried: toolbarButtonHREF="javascript: submitForm('formID'))"
to no avail. I get an errors saying that submitForm() isn't defined.


On Aug 14, 8:17 am, Mobivity <ghar...@mobivity.com> wrote:

unowen

unread,
Aug 15, 2007, 8:49:33 AM8/15/07
to iPhoneWebDev
try this:
href="javascript: document.getElementById('formID').submit();"

Ralist

unread,
Aug 15, 2007, 12:46:33 PM8/15/07
to iPhoneWebDev
Why don't you guys use XML instead of unvalid HTML?

BikePilgrim

unread,
Aug 16, 2007, 12:56:08 PM8/16/07
to iPhoneWebDev

I'm open to suggestions if you have one, but I'd guess that we're
using invalid HTML because it works on the device we are targeting and
its easy. What more do you need?

BikePilgrim

unread,
Aug 16, 2007, 12:58:53 PM8/16/07
to iPhoneWebDev


Tried it. Seems iui uses a serialize and Ajax approach to forms which
I can't seem to invole outside of an iui page> > >

Reply all
Reply to author
Forward
0 new messages